Description
Per the QT qregex documentation , see the section on Characters and Abbreviations for Sets of Characters:
Note: The C++ compiler transforms backslashes in strings. To include a
\
in a regexp, enter it twice, i.e.\\
. To match the backslash character itself, enter it four times, i.e.\\\\
.
Care to give this a try:
[\\\\]{1,2}(u)
I've entered 4 backslashes so the various language layers can escape the backslash correctly. Then nested it inside square brackets and required it to appear 1 to 2 times. Essentially this should find the single and double backslashes before the letter u
. You could then just replace with %u
as in your example.
In my example the u
character is captured and should be returned as group 1 to be used later in your replacement.