| Summary: | regex | ||
|---|---|---|---|
| Product: | [Applications] kate | Reporter: | ch-hamburger |
| Component: | search | Assignee: | KWrite Developers <kwrite-bugs-null> |
| Status: | RESOLVED INTENTIONAL | ||
| Severity: | normal | CC: | christoph, kare.sars |
| Priority: | NOR | ||
| Version First Reported In: | 17.12.0 | ||
| Target Milestone: | --- | ||
| Platform: | Kubuntu | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
Is this the built-in search or the search plugin?
In the plugin you do not need to escape '{' in the replace
This is the built-in search.
In the 'Find' entry the escape of '{' is a must.
In the 'Replace' entry the expected result is obtained by NOT escaping the '{'. But it is not the idea that 'Find' and 'Replace' should require different regex code.
The replace part only supports references like \0, \1, ... Indeed, you should not escape anything else. Maybe we should investigate more, but if you get the correct behavior without \, then this issue is minor. The problem may be minor, though it is illogical that 'Find' and 'Replace' should behave differently. But one or two explanatory lines in the manual, of which you are co-author, would do no harm. :) New information was added; changing status for inspection. Changing status. Hmm, the thing is:
The search part of the find and replace is a regex.
The replacement part is a string, with for regex the capture \xxx escapes.
In my eyes it makes no sense to force people to escape their replace strings like an regex for no good reason.
At the moment, you can just write (if regex on or not).
find: XXX
replace: lala{dddd}
I don't think we want to enforce that { needs to be escaped in the replace string if we turn on regex search.
Therefore I would like to keep it as it is.
I hope that is ok for you.
|
Suppose I want to replace "f{x}" by "f{y}". I use the regex replace command in Kate with the entries: Find: \{x Replace: \{y But I end up with "f{xy}" instead of "f{y}".