|
I'm trying to write a scanner using Flex.
The problem is that one of my regex's works in the Visual Studio Find dialog, but not in Flex when tested on the same file!
By "not working" I mean that it doesn't find any matches.
\'((.)|(\\['"?\\abfnrtv])|(\\[0-7]{1,3})|(\\[Xx][0-9a-fA-F]+))\'
This regex is supposed to recognize any character literals, like 'a' , '\t' , '\012' , or '\x01AF' .
Can anyone suggest why this regex is not finding any matches in Flex?
SOLVED: It turns out that I had other rules that were consuming the character literals earlier in the process.
The difficult we do right away...
...the impossible takes slightly longer.
modified 6-Sep-12 16:11pm.
|
|
|
|
|
Taking a quick look at the (not terribly impressive) Flex docco, I'd suggest you try the Posix-compliance switch to Flex to see if that helps. Either way, you'll have eliminated some variables.
fwiw, Expresso thinks you regex is OK.
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Peter_in_2780 wrote: Expresso thinks you regex is OK.
Thanks for your help.
I solved it.
It turns out to be a case of the computer doing what I told it to do instead of what I wanted it to do.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|