
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
This document contains a quick overview with the main RegEx notions.
Typology: Cheat Sheet
1 / 1
This page cannot be seen from the preview
Don't miss anything!
Anchors (boundaries) ^ Start of string or line $ End of string or line \A Start of input (ignores 'm' flag) \Z End of input (ignores 'm' flag) \G End of the previous match \b Word boundary (any position proceeded or followed - but not both - by a letter, digit or underscore) \B Non-word boundary Character and Sets \w Word [a-zA-Z0-9_] \W Non-word [^a-zA-Z0-9_] \d Digit [0-9] \D Non-digit \s Whitespace (Form-feed, tab, vertical-tab, new line, carriage return and space) [\f\t\x0b\n\r ] \S Non-whitespace \x Hexadecimal digit \x00=null; \x0d=\r; [\x61-\x7a]=[a-z] \O Octal digit
. Any character (except new line \n) Groups (...) Capture group - captures a set of characters for a later expression (?:...) Non-capture group - groups an expression but does not capture. e.g. /((?:foo|fu)bar)/ matches "foobar" or "fubar" without "foo" or "fu" appearing as a captured subpattern (? =...) Lookahead - match on the characters following. e.g. /ab(?=c)/ match "ab" only when followed by "c" (?!...) Negative lookahead - match on characters that aren't following. e.g. /ab(?!c)/ match "ab" only when NOT followed by "c" (? <=...) Positive look-behind assertion. e.g. /(?<=foo)bar/ matches "bar" when preceded by "foo" (?
. * \ + |? Additionally the hyphen (-) and close square bracket (]) must be escaped when in an expression set ([...]). e.g. /\(\d{3}\) \d{4}[\- ]\d{4}/ matches "(nnn) nnnn-nnnn" or "(nnn) nnnn nnnn" (where n is a numeric digit). By **doublehelix** cheatography.com/doublehelix/ Published 30th January, 2017. Last updated 31st January, 2017. Page 1 of 1. Sponsored by **Readability-Score.com** Measure your website readability! https://readability-score.com