Consider the following line:
ab(cd.xz) e(ab(fg).xz)) ab(hi.xz)
I want to match each substring that starts after ab (and ends with z. So I wrote the following regular expression:
(?<=a.*?\().*?z
This should be done according to RegexBuddy:
Assert that the regex below can be matched, with the match ending at this position (positive lookbehind) «(?<=a.*?\()»
Match the character "a" literally «a»
Match any single character that is not a line break character «.*?»
Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?»
Match the character "(" literally «\(»
Match any single character that is not a line break character «.*?»
Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?»
Match the character "z" literally «z»
The result obtained in RegexBuddy is the following matches (note that the middle one does not work correctly, as it must match fg).xz). What am I doing wrong?
http://img101.imageshack.us/img101/7753/regex.jpg
source
share