RegEx Cheat Sheet For Notepad
RegEx Cheat Sheet For Notepad
Notepad++
(by Andreas Radsziwill)
Terminolog Definition
y
Character A single letter, digit, punctuation marker, whitespace, etc.
Whitespace Any character that is not visible: space, tab, etc.
String Any sequence of characters.
Operator Characters with special meaning in a particular context.
RegEx Effect Example
a Find character ‘a’
abc Find string abc
[…] Find any of ‘…’ [abc] finds characters ‘a’, ‘b’, or ‘c’
[a-z] Find any in the range from ‘a’ to [a-f] finds any of the lowercase
‘z’ letters ‘a’ to ‘f’
[^x] Find anything that is not ‘x’ [^aeiou] Finds all characters that are
not vowels, including punctuation,
digits and whitespace
? The previous element is optional, [1-9][0-9]? Finds numbers
it does not have to occur from 1 to 9 and 10 to 99
. Find any character
except newline, linefeed, carriage
return
+ Find the previous element 1 to r+ finds ‘r’, rr, rrr, rrrr, etc.
many times
* Find the previous element 0 to [a-zA-Z]*ed finds strings ending
many times in ed
{x,y} Repeat the previous element x to y [0-9]{5,7} Finds any sequence of 5
times to 7 digits.
(…) Save anything inside the (store this) finds and stores the
parentheses for use in replacement string store this
\1 \2 \3 Restore the string saved by the \1ing adds ing to the saved string
parentheses, for use in replacement
\w Shortcut for word characters \w*
(letters, digits and underscores) finds cat, dog, login_name, cutie17,
etc.
\d Shortcut for digits, same as [1-9]
\b Marks the beginning or end of a
word
\ Escape the operator following ‘\’ \[\w*\] finds a word in brackets
Some examples
Counting part of speech tags