It’s in our muscle memory. Press Ctrl+F in your favorite text editor to find something, provide find criteria, and hit the Find button. As always, we usually stick with the simple Find functionality of the text editor as it serves almost all of our basic search needs. But beneath Find dialog box, there is a powerful Find option, Use Regular Expressions which most seldom use.
Able to recall a correct regular expression when we need it most is rare. Which often leads to the hassle of googling regular expression and trying few failed attempts, and going back to simple Find. This is where following regular expressions cheatsheet comes handy for me.
Have foo anywhere and bar later in the same line
Have foo at the beginning of the line
Have foo at the beginning of the line and bar later in the same line
EXECsp_msforeachdb'USE ?; IF EXISTS(SELECT 1 FROM [?].sys.objects WHERE name=''<<SP NAME>>'') PRINT DB_NAME() '-- Example:
EXECsp_msforeachdb'USE ?; IF EXISTS(SELECT 1 FROM [?].sys.objects WHERE name=''usp_CommentTree'') PRINT DB_NAME() '