Skip to content

Instantly share code, notes, and snippets.

@ufukomer
Created February 21, 2017 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ufukomer/844c69e77ac985c8d14885f531243251 to your computer and use it in GitHub Desktop.
Save ufukomer/844c69e77ac985c8d14885f531243251 to your computer and use it in GitHub Desktop.
Regexp notes
[^] -> any character that is not in the empty set of characters
. -> any number of non-newline characters
(+, *, ?, and {}) -> Greedy
(+?, *?, ??, {}?) -> Nongreedy
\b -> word boundary
\w -> alpha numerical [A-Za-z0-9_]
\d -> number
\s -> single white space
flags
g -> global (match all matches)
i -> case intensitive
^ -> beginning of input
$ -> end of input
caution!
^ -> could be used as both beggining and not. For example /[^\w\s]/ it correponds 'not' in here, none of word and space
http://eloquentjavascript.net/09_regexp.html#p_0Mx4Lf/w4/
$& -> means whole match when used as a second arg of replace method
http://eloquentjavascript.net/09_regexp.html#p_0Mx4Lf/w4/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment