Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with regex
#1
In the following string named subject, I need to establish a pattern to match %IconFol%\......ico substrings. I am sorry if the solution is somewhere in the forum, I tried unsuccessfully. Any help is welcome.

Function tempf10
Code:
Copy      Help
str subject="Abcd12 %IconFol%\lykaio.ico Tree Tamtiriri %IconFol%\tree.ico Tzuni %IconFol%\tree.ico"
str pattern="%IconFol%\\*"

ARRAY(str) a
if(findrx(subject pattern 0 1|4 a)<0) out "does not match"; ret
int i; int n=a.len
out n
for i 0 n
,out a[0 i]
#2
This is a solution I found. At present it works :

Function tempf11
Code:
Copy      Help
ARRAY(str) a
if(findrx(subject pattern 0 1|4 a)<0) out "does not match"; ret
int i; int n=a.len
for i 0 n
,out a[0 i]
#3
You could try this, too:

Macro Macro12
Code:
Copy      Help
str subject="Abcd12 %IconFol%\lykaio.ico Tree Tamtiriri %IconFol%\tree.ico Tzuni %IconFol%\tree.ico"
str pattern="%i(.){8}"
ARRAY(str) a
if(findrx(subject pattern 0 1|4 a)<0) out "does not match"; ret
int i; int n=a.len
for i 0 n
,out a[0 i]
#4
Many thanks indeed. Best regards.


Forum Jump:


Users browsing this thread: 1 Guest(s)