[kde-doc-english] subpatterns in regexp replacement text

Eric Schwarzenbach eric at blackbrook.org
Tue Jul 8 21:42:47 UTC 2014


Hi,

I'd like to suggest that in the regexp section of the Kate docs 
(http://www.kate-editor.org/doc/regex-patterns.html), you mention, or 
even emphasize, that you can reference subpatterns in the replacement 
text. This a is a very powerful feature which is absolutely necessary 
for doing certain kinds of replacements, and so might even warrent its 
own subsection.

For example, find

PROBLEM ([0-9]+)

and replace with

<bold>PROBLEM \1</bold>


I make this suggestion after I went looking for this in the kate 
documentation. I've done this before with other regexp tools but 
couldn't remember the syntax. I couldn't find it, and ended up looking 
it up in some other (non-Kate) regexp writeup and the syntax I found 
worked. Looking at the documentation again, I think the Sub Patterns 
section essentially explained the basic feature, just not in the context 
of replacement, or mentioning that this was possible at all. Perhaps a 
section dedicated to what you can do with the replacement text would be 
the place for this.

Cheers,

Eric


More information about the kde-doc-english mailing list