Created
April 5, 2011 10:39
-
-
Save clm-a/903410 to your computer and use it in GitHub Desktop.
A regexp not to match a whole word.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# following DOES match "foobar", "fooadmin", "adminbar", "fooadminbar" but not "admin" as a whole word : | |
/^((?!\badmin\b)[^\s]*)$/ | |
# more reserved keywords : | |
/^((?!\badmin\b|\bteam\b)[^\s]*)$/ | |
# http://www.regular-expressions.info/wordboundaries.html | |
# http://www.regular-expressions.info/lookaround.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment