Negative lookahead can be used to see if the next element would match a certain pattern. It's often used to prevent a greedy construct from matching a special sequence. For example when matching a quoted string everything should be ignored except for the closing double quote. Using negative lookahead we could do something like this:
Search | "\"" {~"\"" .} "\"" |
Search | "\"" {'~"'} "\"" |
The ignored character set { ' ~ " '} wil match anything other than a double quote. (I have added spaces to that expression to reduce confusion as Netsurf won't do character-spacing)
You may like to try this on the sample text - you should find four such quoted strings.
Was this page helpful? Please email me and/or rate this page: