Bug 496460 - Lookarounds break the "export pattern" feature.
Summary: Lookarounds break the "export pattern" feature.
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: search (show other bugs)
Version: 24.08.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: info
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-19 13:14 UTC by qaliboire.bug_report
Modified: 2024-12-01 23:31 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 24.12.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description qaliboire.bug_report 2024-11-19 13:14:03 UTC
SUMMARY
When a regular expression search is done using a pattern that includes a lookaround, the "export pattern" feature outputs the capture pattern entered by user, instead of the contents of the corresponding capturing group(s).

STEPS TO REPRODUCE
1. open a new editor and type:
1foo
2bar
2. in the "Search" section, do a regular expression search for "(\d)(?=\w+)";
3. right-click in the sub-section that displays the matches and select "Export matches";
4. type "\1" in the "Export Pattern" field and click on "Generate".

OBSERVED RESULT
The "Result" field shows:
\1
\1

EXPECTED RESULT
We expect the same output as we would get with the pattern "(\d)\w+", i.e.:
1
2

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora Linux 40
KDE Plasma Version: 6.2.3
KDE Frameworks Version: 6.8.0
Qt Version: 6.7.2

ADDITIONAL INFORMATION
Lookbehinds (e.g. "(?<=\d)(\w+)") cause the same problem as lookaheads.
Comment 1 Kåre Särs 2024-11-19 13:57:45 UTC
"Export matches" is a bit of an exotic feature, and yes the lookaheads and lookbehinds break the export
Comment 2 Christoph Cullmann 2024-12-01 14:01:31 UTC
Fixed! (and backported)
Comment 3 qaliboire.bug_report 2024-12-01 23:31:33 UTC
(In reply to Christoph Cullmann from comment #2)
> Fixed! (and backported)

Fantastic! Thank you very much!