[texworks] Search and replace using regex

Joseph Wright joseph.wright at morningstar2.co.uk
Sat Aug 21 19:25:52 CEST 2010


Hello all,

I'm continuing with my attempts to get to grips with regex searching. I 
think I understand the search part of the system as implemented in 
TeXworks, but am stuck with the replace part. For example, I recently 
wanted to search for

   \\(?:\w+)\s+\\tex_(?:\w+):D

(for some LaTeX3 stuff) and replace it with the expression

   \\tex_\2:D \\\1

i.e. with the two command sequences interchanged. However, I just get 
literal '\1' and '\2' as replacements when I try this (the search itself 
is fine). Is there a way to get the matched groups from the search in 
the replace part?
-- 
Joseph Wright


More information about the texworks mailing list