Back to Reference Guides
Developer ReferenceECMAScript / PCRE Compliant
Regular Expressions (Regex) Cheat Sheet
Quick reference guide for regex syntax, anchors, lookaheads, and copy-paste production patterns. Test any pattern live using our in-browser Regex Tester Tool.
Anchors & Boundaries
^Start of string or start of line with multiline flag (m)$End of string or end of line with multiline flag (m)\bWord boundary (start or end of a word)\BNon-word boundaryCharacter Classes & Shorthands
.Any character except newline (matches newline with dotAll s flag)\dAny digit [0-9]\DAny non-digit [^0-9]\wAny word character [a-zA-Z0-9_]\WAny non-word character\sAny whitespace (space, tab, newline)\SAny non-whitespace characterQuantifiers
*0 or more times (greedy)+1 or more times (greedy)?0 or 1 time (optional) or makes quantifier lazy (*?, +?){n}Exactly n times{n,}At least n times{n,m}Between n and m timesLookaround Assertions
(?=abc)Positive Lookahead: Matches if followed by "abc"(?!abc)Negative Lookahead: Matches if NOT followed by "abc"(?<=abc)Positive Lookbehind: Matches if preceded by "abc"(?<!abc)Negative Lookbehind: Matches if NOT preceded by "abc"Tested Production Pattern Recipes
^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$Standard Email Addresshttps?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)HTTP/HTTPS URL^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$IPv4 Address^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$Strong Password (8+ chars, 1 letter, 1 number, 1 special)^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$UUID v4