use of REGEX_SEARCH to match lookahed subexpression.
Dear Regex Guru, I am trying to use REGEX_SEARCH algorithm to match lookahed subexpression. Search in the folowing strings (see below) using expression like: /exchange/test/(?!Drafts)/a.EML/b.png fails /exchange/test/Drafts/a.EML/b.gif /exchange/test/Inbox/a.EML/b.png /exchange/test/Inbox/a.EML/b.gif /exchange/test/Drafts/a.EML/b.png At the same moment I can suceesfully search using the expression: /exchange/test/Inbox/a.EML/b.(?!png).
From online documentation I realize that regex supports lookahed search. Please help me understand what I am doing wrong.
P.S. It is tested with the program closely modeled from example provided for regex_search. Thank you for your help. Yan Belinky Senior Software Engineer. Whale Communications, LTD.
Search in the folowing strings (see below) using expression like: /exchange/test/(?!Drafts)/a.EML/b.png fails /exchange/test/Drafts/a.EML/b.gif /exchange/test/Inbox/a.EML/b.png /exchange/test/Inbox/a.EML/b.gif /exchange/test/Drafts/a.EML/b.png
At the same moment I can suceesfully search using the expression: /exchange/test/Inbox/a.EML/b.(?!png).
Remember that a lookahead assertion doesn't consume any characters, so for your expression to match it would have to find a string: /exchange/test//a.EML/b.png To do what you want, add a [^/]+ after the assertion: /exchange/test/(?!Drafts)[^/]+/a.EML/b.png Regards, John Maddock
participants (2)
-
John Maddock
-
yanbelinky