Skip to content

Instantly share code, notes, and snippets.

@tak1n
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tak1n/9778151 to your computer and use it in GitHub Desktop.
Save tak1n/9778151 to your computer and use it in GitHub Desktop.
There are several built-in machines available for use. They are all two state machines for the purpose of matching common classes of characters. They are:
– any – Any character in the alphabet.
– ascii – Ascii characters. 0..127
– extend – Ascii extended characters. This is the range -128..127 for signed alphabets and the range 0..255 for unsigned alphabets.
– alpha – Alphabetic characters. [A-Za-z]
– digit – Digits. [0-9]
– alnum – Alpha numerics. [0-9A-Za-z]
– lower – Lowercase characters. [a-z]
– upper – Uppercase characters. [A-Z]
– xdigit – Hexadecimal digits. [0-9A-Fa-f]
– cntrl – Control characters. 0..31
– graph – Graphical characters. [!-˜]
– print – Printable characters. [ -˜]
– punct – Punctuation. Graphical characters that are not alphanumerics. [!-/:-@[-‘{-˜]
– space – Whitespace. [\t\v\f\n\r ]
– zlen – Zero length string. ""
– empty – Empty set. Matches nothing. ˆany
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment