Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with regular expressions and tok
#2
Example with tok.
Macro
Code:
Copy      Help
out

str subject="''pns1'', ''pn, s2'': goto xxx"

;at first separate part after :
int i=findcr(subject ':')
str afterColon
if(i>=0) afterColon.get(subject i+1); afterColon.ltrim; subject.fix(i)

out subject
out afterColon
out "--------"

;then tok
ARRAY(str) a ae
tok subject a -1 "'', " 4 ae
for i 0 a.len
,out "'%s'    '%s'" a[i] ae[i]

Example with rx. Use flag 4.
Macro
Code:
Copy      Help
out

str subject="''pns1'', ''pn, s2'': goto xxx"
str pattern="''([^'']+)''[\s,]*"
int i; ARRAY(str) a
if(findrx(subject pattern 0 4 a)<0) out "does not match"; ret
for i 0 a.len
,out a[1 i]


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)