Bug 66208 - EDITING backreference in Search must be written with backslash, backreference in Replace must be written with dollar sign
Summary: EDITING backreference in Search must be written with backslash, backreference...
Status: RESOLVED NOTOURBUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
4.0.4.2 release
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-26 13:45 UTC by Mirosław Zalewski
Modified: 2013-07-07 18:50 UTC (History)
0 users

See Also:
Crash report or crash signature:
Regression By:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mirosław Zalewski 2013-06-26 13:45:18 UTC
New regex engine is great, but backreferences in Search field must be written with backslash (\1, \2 etc.), while backreferences in Replace field must be written with dollar sign ($1, $2 etc.).

This is inconsistent and brings confusion to user.

To see what I mean:

1. Create new Writer document. Write "test test"
2. Open search and replace dialog, check "Regular expression"
3. In Search enter:
\b(\w+)\b
in replace:
$1ing
press "Replace all".
You should get "testing testing"
4. In Search enter:
\b(\w+)\b\s*$1
in replace
$1
press "Replace all"
Error will occur that match could not be found.
5. In Search enter
\b(\w+)\b\s*\1
in replace
$1
press "Replace all"
duplicated string will be deleted.

tested under LO 4.0.4, Debian testing amd64.
Comment 1 Mirosław Zalewski 2013-07-07 18:50:10 UTC
After reading through ICU regex list[0] again, carefully, I now know that this is intended.

I still think that this is confusing and should be changed, but this is pretty much ICU design decision, so pretty much NOTOURBUG.


[0] http://userguide.icu-project.org/strings/regexp