Bug 167871 - RegEx search and replace inserts literal $1 instead of match
Summary: RegEx search and replace inserts literal $1 instead of match
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.4.2 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-08-08 15:35 UTC by R H
Modified: 2025-08-09 01:11 UTC (History)
0 users

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 R H 2025-08-08 15:35:03 UTC
Description:
I have a text like
…Dann müssen wir "an­täuschen", dass der…

I use a regex search/replace to change "an­täuschen" into „antäuschen“ like so:

Find: \b"([:alpha:]+)"\b
Replace: „$1“

The replacement yields

…Dann müssen wir „$1“, dass der…

the word also has a conditional hyphen between n and t.
Regex is enabled, as is diacritic-sensitive.

Steps to Reproduce:
1. write text like in description
2. enter search and replace pattern, check regex and diacritic
3. find next, replace

Actual Results:
replacement is „$1“

Expected Results:
„antäuschen“


Reproducible: Always


User Profile Reset: No

Additional Info:
will try latest version, too
Comment 1 R H 2025-08-08 15:56:53 UTC
Behaviour seems to depend on the conditional hyphen. 

However, \b"([:alpha:]+[:cntrl:]*[:alpha:]+)"\b doesn’t help, either.

Also, since „Replace“ jumps to the next match, I can’t see if the replacement works as expected.
Comment 2 R H 2025-08-08 15:57:35 UTC
Happens in 25.2.5.2, too.
Comment 3 fpy 2025-08-09 01:11:26 UTC
note also a soft hyphen is not matched by any character regex (".")