regex - Problem with regular expression replacement in Visual Studio 2003 -
I am in the process of converting some latex documentation into a redesigned text and some problems with a regular expression in Visual Studio 2003 I'm trying to convert \ emph {text} to * text * using the Find / Replace string by following:
\\ emph \ {([^ \}] *) \ } * \ 0 *
However, using this pair, I was converting \ emph {text} to * \ emph {text} * which I Mid was not. When I use * \ 0 * instead of * * 1 *, I get ** as a replacement result.
Am I missing or do not understand the rules of the group?
Thank you.
I think that VS In Regex replacement syntax, \ 0 is a full-matched string, while \ 1 is the content of the first captured variable (\ 2 second and so on) therefore:
\ 0 < / Em>
However, using this pair, I was converting \ emph {text} to * \ emph {text} * which was not what I expected.
To confirm this way, \ 0 is a complete matching string.
When I get ** * * instead of * * * I get the replacement result **.
Perhaps you do not match anything in the capture class.
To add more detail, the syntax class (which is called tagged expression) uses braces to define a capture {}, not brackets (), as you would like Are using here Perhaps this will work as a "search" expression:
\\ emph \ {{^ ^}} *} \}
Comments
Post a Comment