Apache OpenOffice (AOO) Bugzilla – Issue 118925
ICU Regex: look-ahead and look-behind are not work well with replacement
Last modified: 2012-06-26 08:05:57 UTC
On revision 1240836 from unofficial dev build. Text: abcdef Search for: ab(?=c) Replace with: -$0- This look-ahead matches "ab" for search but replacement results "-$0-cdef" Next look-behind example does not match anymore. Search for: (?<=b)c This should be match with "c" but recent build does not match with it. With Python's re module, it matches "c".
Thanks for the report. The regression described in the report's second issue is now fixed with revision 1301596. The first problem described in the report has its root cause somewhere in Writer where for some reason Writer checks itself whether the found string is really a match. This seems to fail; probably because Writer doesn't understand the advanced constructs of the new engine like look-ahead/look-behind yet. I think the easiest solution would be simply having WriterEngine trust the findings of the regexp engine. Changing things in that critical area are too risky for now.
FWIW: a code pointer to the first issue would be ReplaceBackReferences() in main/sw/source/ui/uiview/viewsrch.cxx
(In reply to comment #2) > in main/sw/source/ui/uiview/viewsrch.cxx Correction, the function is in: main/sw/source/core/crsr/findtxt.cxx
With rev 1336210 I added support to make group-references in the replacement string work for look-ahead/look-behind regexp contexts.
Requesting the 3.4.1 flag for this issue: Writer should keep up with the features of the regexp engine that has become much more powerful with AOO 3.4.0. Otherwise the asymmetry between the Find and the Replacement functionality would be too confusing.
set release blocker flag for 3.4.1 we exchanged the regex engine for 3.4 and this fix will improve/finalize the replacmeent
Also applied into AOO34 branch as 1346922.
Verify fixed on AOO 3.4 Branch Dev snapshot rev.1351960 and AOO Trunk Rev. 1351712 Suggest close this bug
Thanks for verifying on trunk and release branch! Closing the resolved bug.