regexfindssms-2005

Regex find not working in SSMS query window?


I'm trying to find the next BEGIN or END without missing any, so I want to search with a regex in the find. I want to find the next BEGIN or END.

For some reason it's not working. What's wrong with what I am doing?

enter image description here


Solution

  • SSMS (and Visual Studio too) uses a CRAZY Regex flavor, and it's always a huge pain to use. I CAN'T BELIEVE they don't use the .NET Regex engine!

    Here's the documentation, which you should definitely bookmark if you ever plan on using Regex again.

    The Regex you should use is:

    <(begin|end)>
    

    Unusual keys:
    < beginning of a word
    > end of word
    () group -- however, for capturing (and replacing), you must use {}

    You can also see a quick-list of "special characters" by clicking the little > button that appears to the right of the text box. This is basically a built-in cheat-sheet.