You only use regexp names option if you have search patterns of the form (?<NAME>PATTERN) in which case it searches for the pattern and puts matches into aa structure using NAME as the field name . In your case the pattern would be <TokenName> . Note that the <> after the ? are part of the syntax whereas the <> around TokenName are literal text .
Because the content matched by the pattern is returned and your content is static there is not much point using the syntax . You would be better off with no regexp option and so returning the match position .
However .... what would probably make more sense is to go directly to regexprep to do the search and replace without caring about the position .
Best Answer