T
Tobias Weihmann
Hi,
I'm trying to parse VB strings here but I didn't succeed in getting
the regex to ignore pairs of double quotes (which are the equivalent to
\" in Perl)
Example:
print "This is a test ""Test"" yeah" + Str$(4)+ "good"
--> This is a test ""Test"" yeah
--> good
print """We""are""testing"""+"What they can do" '
--> ""We""are""testing""
--> What they can do
I finished off writing a FSM, but this is quite clumsy compared to a
regex. The best thing I had was like /"(.*?)"[^"]/, but this would get me
--> This is a test "
for the first example... ( the "T satisfies the end condition, even though
the two quotes should be ignored altogether)
I also considered /"(.*?[^"])"[^"]/, but this will break in the second
example - because it is's of course possible to have two quotes (to be
ignored) right before a quote finishing of the string. I also experi-
mented with non-moving sequences (?!"") but to no avail...
How would you do it?
Cheers!
Toby
I'm trying to parse VB strings here but I didn't succeed in getting
the regex to ignore pairs of double quotes (which are the equivalent to
\" in Perl)
Example:
print "This is a test ""Test"" yeah" + Str$(4)+ "good"
--> This is a test ""Test"" yeah
--> good
print """We""are""testing"""+"What they can do" '
--> ""We""are""testing""
--> What they can do
I finished off writing a FSM, but this is quite clumsy compared to a
regex. The best thing I had was like /"(.*?)"[^"]/, but this would get me
--> This is a test "
for the first example... ( the "T satisfies the end condition, even though
the two quotes should be ignored altogether)
I also considered /"(.*?[^"])"[^"]/, but this will break in the second
example - because it is's of course possible to have two quotes (to be
ignored) right before a quote finishing of the string. I also experi-
mented with non-moving sequences (?!"") but to no avail...
How would you do it?
Cheers!
Toby