Code Snippets
Title: Count words in a string.
Description: Regular expression to count word in a string using common character groupings.
Category: Regex
Visibility: Public
Added by: ohanlonp on 5/6/2012
Currently rated 5 by 1 user(s)
(?:\d[\.,:]\d|\w[-\.']\w|\w)+
Title: Find WHERE = NULL
Description: Locate instances of the problematic WHERE clause
Category: Regex
Visibility: My team
Added by: Scott Wenzel on 1/4/2013
This snippet currently has no votes. Why not log in and be the first to rate it?
The following regular expression locates all occurrences of WHERE
followed by an equal sign, followed by NULL:
WHERE.*=:b*NULL
Dissection:
WHERE first string fragment to find
. any character
* zero or more occurrences of the previous string (any character)
= next string fragment to find
:b space or tab
* zero or more occurrences of the previous string (space or tab)
NULL next string fragment to find
The following regular expression locates all occurrences of WHERE
followed by an equal sign, followed by NULL
where the line has been commented out:
^:b*'.*WHERE.*=:b*NULL
Dissection:
^ beginning of line
:b space or tab
* zero or more occurrences of the previous string (space or tab)
' VB comment character
. any character
* zero or more occurrences of the previous string (any character)
The following regular expression locates all occurrences of WHERE
followed by an equal sign, followed by NULL where
the line has NOT been commented out:
^~(:b*').*WHERE.*=:b*NULL
Dissection:
^ beginning of line (expression does not work if ^ is in the enclosed expression)
~ prevent match of the following expression
() grouping of the enclosed expression