Regular Expression Basic Characters

Regular Expressions use punctuation characters to tell our system what to do when looking for something. These characters can call the following types of behavior:

  • find this kind of character
  • this many of a character
  • look for this particular thing and make sure it's not targeted
  • something within this range

Here's a list of the things you'll be using most often:

Common Regex Characters

Character Pattern Name Description
. Period Matches any character
x* Star/Asterisk Matches zero or more of the preceding character (in this case, x)
.* Period-Star Matches any number of any character (anything, basically!)
x+ Plus Matches one or more of the preceding character(in this case, x)
\ Backslash Next character is to be treated differently, or "escaped."
x? Question Mark Preceding character is optional. Matches zero or one occurrence
\d Escape-d Matches any single digit (0-9)
\w Escape-w Matches any word character (letters, numbers and underscore)
x|y Or pipe Matches x OR y
(hats?|scar(f|ves)) Parentheses

Group specific items together. This example will match

hat, hats, scarf, scarves

[xyz] Brackets Specify ranges of letters and numbers

Please see this Note on Regular Expression Characters for additional information.


Previous - Next

Have more questions? Submit a request
Powered by Zendesk