Regular Expression

From Ideasplace
Revision as of 17:32, 23 January 2026 by Wikisysop (talk | contribs) (Created page with "==Basic RegEx Cheat Sheet== {| class="wikitable" ! Symbol !! Name !! Meaning !! Example !! Matches |- ! colspan="5" style="text-align:center;" | Literals |- | (text) || Literal || Matches exact text || <code>cat</code> || "cat" |- ! colspan="5" style="text-align:center;" | Wildcards & Classes |- | <code>.</code> || Dot || Matches '''any''' single character || <code>h.t</code> || "hat", "hot" |- | <code>[ ]</code> || Brackets || List of allowed characters || <code>b[ai]t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Basic RegEx Cheat Sheet

Symbol Name Meaning Example Matches
Literals
(text) Literal Matches exact text cat "cat"
Wildcards & Classes
. Dot Matches any single character h.t "hat", "hot"
[ ] Brackets List of allowed characters b[ai]t "bat", "bit"
[^ ] Negation Matches anything NOT in the list [^a] Any char except 'a'
Quantifiers
* Star 0 or more times go*d "gd", "god", "good"
+ Plus 1 or more times go+d "god", "good"
? Question 0 or 1 time (Optional) colou?r "color", "colour"
Anchors
^ Caret Start of string ^The "The end"
$ Dollar End of string end$ "The end"
Special Characters
\ Escape Treats special characters as text \. "." (actual dot)
\d Digit Any number 0-9 \d\d "42", "99"
\w Word Letter, number, or underscore \w+ "Hello_1"
\s Space Whitespace (space, tab, enter) A\sB "A B"