May 14

Quick RegEx Trick

AnientRegExI thought I blogged this but I guess I didn’t. So I am posting this mostly to save myself time finding this the next time I look for it.

I had a regular expression that returned 2 variables. Here is what I wanted:

$1555$2.

However Lync interprets “$1555” as a variable instead of what I want which is just $1 as the variable. So how do I tell regular expression that it should stop at the first 1 and not continue until the next delimiter ($2)?

Answer:

Use curly braces

Re-writing it in this format got me the desired result:

${1}555$2

The fourth paragraph on this website is what got me the answer – http://www.regular-expressions.info/replacebackref.html

Leave a Reply

Your email address will not be published.

%d bloggers like this: