Bug 53290 - sd is still matching regex expressions even though regex checkbox is unavailable in the Find&Replace dialog (comment 9)
Summary: sd is still matching regex expressions even though regex checkbox is unavaila...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
4.0.0.0.beta1
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:27.2.0
Keywords:
Depends on:
Blocks: Find-Search
  Show dependency treegraph
 
Reported: 2012-08-09 11:51 UTC by Mirosław Zalewski
Modified: 2026-07-14 22:22 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mirosław Zalewski 2012-08-09 11:51:19 UTC
Backreference ($n) in "replace" is not evaluated if word boundary symbol is present in "search" string.

Steps to reproduce:
1. Open new document, write to it:
#v+
what whatever what whatever
what whatever what
#v-
(there is no space after final word)
2. Open "Search and replace" dialog. Check "regular expression" in "More options".
3. In "Search" field write:
(what)\>
4. In "Replace" field write:
$1ever
5. Hit "Replace all"

Expected output:
#v+
whatever whatever whatever whatever
whatever whatever whatever
#v-

Actual output depends on application.
1. Calc gets it all correct (as expected).
2. Impress and Draw gets it all wrong:
#v+
$1ever whatever $1ever whatever
$1ever whatever $1ever
#v-
3. Writer gets it half-correct - backreference is evaluated only if matched word is last word in line:
#v+
$1ever whatever $1ever whatever
$1ever whatever whatever
#v-

I was able to reproduce this behavior on:
1. LibreOffice 3.6 on Windows 7, i386 (only Writer tested)
2. LibreOffice 3.5.5 on Debian, amd64
3. LibreOffice 3.5.0 on Windows 7, i386 (only Writer tested) (build id: 7e68ba2-a744ebf-1f241b7-c506db1-7d53735)

I can not check it on any earlier version of LO, but this is possible regression.

Best regards
Mirosław Zalewski
Comment 1 Mirosław Zalewski 2012-08-16 15:34:57 UTC
Hi

I have tried some other versions (all tests on Windows 7 x86). Results:

1. LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4

Problem exists (Calc gets it correct, Writer gets it half-correct, Impress and Draw get it wrong).

2. OpenOffice.org 3.3.0
OOO330m20 (Build: 9567)

Problem exists (Calc gets it correct, Writer gets it half-correct, Impress and Draw get it wrong).

3. OpenOffice.org 2.4.2

Problem exists (Calc gets it correct, Writer gets it half-correct, Impress and Draw get it wrong).

4. Apache OpenOffice 3.4.0
AOO340m1(Build9590) - Rev. 1327774

Problem is somehow fixed (Calc and Writer get it correct, Impress gets it wrong; Draw is not able to search by regexp anymore).

So, this is not regression - it actually never worked as it should in LibreOffice. I don't know if it ever did in OOo.

Apache guys have fixed Writer - maybe change may be incorporated in LO?
Comment 2 Mirosław Zalewski 2012-11-24 14:21:32 UTC
I can still reproduce it on 3.6.4-rc1.
Marking as NEW, since it is 100% reproducible (different versions on different operating systems).
Comment 3 Michael Meeks 2012-12-18 16:37:40 UTC
As we re-based on the Apache code-base we got this fix for writer - so it works there nicely now. As you note it worked in calc. In draw regexp search has been removed/disabled (no idea why)

That leaves this as an impress issue. Since the whole regex code changed in 4.0 and we will not back-port; I'll pull up the version to that and re-title.

Thanks for the careful report !

If someone is interested in doing more research on this poking at:

svx/source/dialog/srchdlg.cxx

and how that fits into the editeng / text processing in draw would be a good place to start.
Comment 4 novacellus 2013-03-12 10:41:48 UTC Comment hidden (off-topic)
Comment 5 Mirosław Zalewski 2013-03-20 12:41:49 UTC Comment hidden (off-topic)
Comment 6 QA Administrators 2015-02-19 15:42:49 UTC Comment hidden (obsolete)
Comment 7 Buovjaga 2015-03-08 20:01:06 UTC
Impress doesn't have regex in find & replace.

Win 7 Pro 64-bit, LibO Version: 4.4.1.2
Build ID: 45e2de17089c24a1fa810c8f975a7171ba4cd432
Locale: fi_FI

Version: 4.5.0.0.alpha0+ (x64)
Build ID: 5a009a4387a84a36d2e3418c7e7b097cb10c3f5a
TinderBox: Win-x86_64@42, Branch:master, Time: 2015-03-04_15:00:21
Locale: fi_FI

Ubuntu 14.10 64-bit 
Version: 4.4.1.2
Build ID: 40m0(Build:2)
Locale: en_US
Comment 8 Joel Madero 2015-03-11 18:25:02 UTC Comment hidden (obsolete)
Comment 9 Mike Kaganski 2019-12-19 09:10:16 UTC
This is a bug. The missing regex support in Impress is another thing; but in the absence of the support, the search string "(what)\>" in parentheses and with trailing angle bracket should *not* match anything in the search text from repro steps given in comment 0. So the still reproducible result of replacing "what" with "$1ever" (by the way, only the first time after opening F&R dialog: undoing changes in the document without closing the dialog and trying to replace all again does not replace anything) is actually a bug.

Tested with Version: 6.5.0.0.alpha0+ (x64)
Build ID: eb973a46ba0e34026db2d2929f2aa10505623872
CPU threads: 12; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win; 
Locale: ru-RU (ru_RU); UI-Language: en-US
Calc: CL
Comment 10 Mike Kaganski 2019-12-19 09:56:37 UTC
FTR: "Support regexes in Impress" is tdf#122785.
Wrong Word behaviour is fixed in tdf#75806 and tdf#65038.
Comment 11 QA Administrators 2021-12-19 03:48:53 UTC Comment hidden (obsolete)
Comment 12 QA Administrators 2023-12-20 03:12:57 UTC Comment hidden (obsolete)
Comment 13 QA Administrators 2025-12-20 03:12:21 UTC Comment hidden (obsolete, spam)
Comment 14 Justin L 2026-07-14 15:31:05 UTC
repro 26.8 (under very specific circumstances)

1.) In Writer, I have to first open the find and replace dialog (Ctrl-H) and turn on regex. Close LO so regex is saved to user search preferences.
2.) Start Impress or Draw, do a search for (what)\>. It will do a regex search.

Note that any use of the quick find (in either Writer or Impress/Draw) forces regex off.
Comment 15 Commit Notification 2026-07-14 22:22:08 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/ce4939aeacb81d378885dce96947872437c9e631

tdf#53290 srchdlg: only set SearchItem RegExp if button is visible

It will be available in 27.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.