Skip to content

Instantly share code, notes, and snippets.

@bran921007
Created January 28, 2015 01:00
Show Gist options
  • Save bran921007/97a631416d3c40801e02 to your computer and use it in GitHub Desktop.
Save bran921007/97a631416d3c40801e02 to your computer and use it in GitHub Desktop.
Regular Expression notes
-> matches any character
+ -> means match 1 or more times
* -> means match 0 or more times
{5} -> means match {n} times
{3,5} -> means 3 or up to 5 times
^ -> means NOT
[] -> character set
\ -> escape a special meaning
\s -> represents a space ( matches space, tab or line break )
\w -> represents a word character ( lower or uppercase letter or a number )
? -> character before question mark is optional
() -> capture group ( what is inside capture group can be used via $1, $2, $3 etc variables on page )
(ht|f)tps? -> match a url of https, http, ftp or ftps
| -> OR
(:?ht|f)tps?-> match a url of https, http, ftp or ftps but don't make a capture group
i -> flag after /expression/i that means that the case of letters is not important
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment