When I write scripts, every now and then I need to use Regular Expressions. RegEx’s are very powerful, but I don’t use them enough to have it all memorized. So instead of searching for my quick reference book all the time, I just made a Powershell function to display all of the info at the prompt.
Poweshell’s built in “get-help” includes some basic RegEx documentation, but it is lacking some detail, and I don’t want to have to read through all the “fluff” to get to what I want.
The output of the script looks like this:
PS C:\scripts> get-regex | ft -auto Sequence Meaning Table -------- ------- ----- \a Alert (bell), x07. Character r... \b Backspace, x08, supported only in character class. Character r... \e ESC character, x1B. Character r... \n Newline, x0A. Character r... \r Carriage return, x0D. Character r... \f Form feed, x0C. Character r... \t Horizontal tab, x09. Character r... \v Vertical tab, x0B. Character r... \0octal Character specified by a two-digit octal code. Character r... \xhex Character specified by a two-digit hexadecimal code. Character r... \uhex Character specified by a four-digit hexadecimal code. Character r... \cchar Named control character. Character r... [...] A single character listed or contained within a listed range. Character c... [^...] A single character not listed and not contained within a listed range. Character c... . Any character, except a line terminator (unless single-line mode, s). Character c... \w Word character. Character c... \W Non-word character. Character c... \d Digit. Character c... \D Non-digit. Character c... \s Whitespace character. Character c... \S Non-whitespace character. Character c... (etc...)