regex Flashcards
\w
alphanumeric values
r”[\w]ears” === __ears
”^”
matches the position at the beginning of string (unless used for negation “[ˆ]”)
”$”
matches the position at the end of string character.
”?”
match preceding literal or sub- expression 0 or 1 times.
”+”
match preceding literal or sub- expression one or more times.
“*”
match preceding literal or sub- expression zero or more times
”.”
match any character except new line
”[ ]”
match preceding literal or sub- expression zero or more times
”( )”
used to create a sub-expression
” \d “
match any digit character. “\D” is the complement
” \w “
match any word character (letters, dig- its, underscore). “\W” is the comple- ment.
“\s”
match any whitespace character in- cluding tabs and newlines. \S is the complement.
“*?”
Non-greedy version of *. Not fully discussed in class
“\b”
match boundary between words. Not discussed in class.
”+?”
Non-greedy version of +. Not discussed in class.