Can the $rreplace function replace the searched string with a capture group from within the string? If so, how?
Yes, you can. E.g. use “\\1” for the first capture group. Note the double backslash, which is needed to escape the backslash in tagger script.
ah, thanks. I get really confused about how many backslashes I need for what.
Yeah, escaping can be confusing. Especially with regexes or multiple languages embedded in each other. As a side note, writing this here in the forums is also not easy. I had to experiment with the number of backslashes until it displayed correctly (you need to write 3 in order for it to display the whole thing correctly with two).
Oh yeah, i was wrestling with that in another thread. You can get around it with the “preformatted text” option.
To make it more difficult, when I was trying to figure out the forum escaping on another thread, I was trying to get it working in code blocks. For some reason, those seem to use a completely different progression, and other numbers don’t seem to be affected:
\1- \1 -
\\1- \1 -
\\\1- \\1 -
\\\\1- \\1 -
I eventually wound up separating the backslashes with a zero-width space (U+00A0), and putting up a warning that it should be typed – not copied – into the Picard script. I’m not actually sure there’s any way to format an even number of slashes followed by a one in code here, as even <tt> tags have that issue.
EDIT: Found a way to do so, at least for the inline code blocks: put two of the graves between the slashes and the number (\1\\\1\11\1 results in
\\``1, but the string to get the first, non-code-block display there is rather horrific). Not sure how to get that working with the full-line code indenting, though.