9 Dec 2011

Visual Studio RegEx Regular Expression Cheat Sheet

Why MS decided to use a non-standard RegEx parser for Visual Studio 2010's Find/Replace controls, I don't know. All I do know is that I forget the syntax EVERY FRIGGING TIME in the heat of battle. So, here's the skinny:

Match group definition using CURLY BRACE {}
Match group replacement using BACKSLASH \

So to turn <bob.holness> to *bob* use:

FIND: \<{:a#}\>


The :a is the VS alpha-numeric character match pattern
The # is the VS 'non-greedy' 1-or-more match pattern

BREAKING NEWS: Microsoft have come to their senses with VS2012 and use the standard .NET RegEx parser in the Find/Replace box now. Phew.

No comments:

Post a Comment

Comments are very welcome but are moderated to prevent spam.

If I helped you out today, you can buy me a beer below. Cheers!