BugFix Posted July 17, 2008 Share Posted July 17, 2008 (edited) Hi,following problem:I want to check a string of occurence of a word (i.e. appel).condition:Is the word inside a quoted string (with ' or ") shouldn't match.Before match, but also before quoted string, can be written other chars.Match for the word (insensitiv): "(?i)appel"Now negativ Lookbehind (because quotes): "(?<!['\x22])(?i)appel"It works fine.appel are found in: xyz 123 Appelnot found in: 'Appel xyz OR xyz 'Appel ==> BUTalso found in: ' Appel xyzThats why:No qoutes AND (optional) no other chars behind opening quotes.OK, now i use following pattern:"(?<!(['\x22](.+?)|['\x22]))(?i)appel"With external programm (RegexBuddy) it works, but no match with AutoIt.I've also tested: "(?<!(('|\x22)(.+?)|('|\x22)))(?i)appel"and it's also fails only in AutoIt.Any Ideas?Global $s[4] = ["xyz 123 Appel","'Appel xyz"," Appel xyz",'xyz " Appel'] For $i = 0 To UBound($s) -1 ConsoleWrite($s[$i] & ' = ' & @TAB & StringRegExp($s[$i], "(?<!(['\x22](.+?)|['\x22]))(?i)appel") & @CRLF) Next Edited July 17, 2008 by BugFix Best Regards BugFix Link to comment Share on other sites More sharing options...
rudi Posted July 17, 2008 Share Posted July 17, 2008 Hi.Have a look at the syntax description for PCRE if you can see what's giving the trouble you face.If I understood the help file correctly, PCRE the "RegEx-Engine" used by autoit.A link to that URL is provided in the help file, topic "StringRegExp", just above the table, the paragraph "Complete description can be found here"Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now