A Cheat Sheet of Common Regex Task Chunks

Usage

cheat(dictionary = qdapRegex::regex_cheat, print = TRUE)

Arguments

dictionary
A dictionary of cheat terms. Default is regex_cheat.
print
logical. If TRUE the left justified output is printed to the console.

Value

Prints a cheat sheet of common regex tasks such as lookaheads. Invisibly returns regex_cheat.

Description

Print a cheat sheet of common regex task chunks. cheat prints a left justified version of regex_cheat.

Examples

cheat()
NAME REGEX WHAT IT DOES 1 Lookahead (?=foo) What follows is `foo` 2 Lookbehind (?<=foo) What precedes is `foo` 3 Negative Lookahead (?!foo) What follows is not `foo` 4 Negative Lookbehind (?<!foo) What precedes is not `foo` 5 Non-Capturing Group (?:foo) Match this group (`foo`) but with no capture 6 Exception [^X] Match everything except `X` 7 Dot . Match any character 8 Case Insensitive (?i:foo) Matches irregardless of case; `Foo` & `foO` matched 9 Digit \\d Match digits (i.e., [0-9]) 10 Non-Digit \\D Match non-digits (i.e., [^0-9]) 11 Word \\w Match words (i.e., [_a-zA-Z0-9]) 12 Non-Word \\W Match non-words (i.e., [^_a-zA-Z0-9]) 13 Whitespace \\s Match whitespace (i.e., [ \\t\\r\\n\\f]) 14 Non-Whitespace \\S Match non-whitespace (i.e., [^ \\t\\r\\n\\f]) 15 Word Boundary \\b Match beginning/end of word 16 Non-Word Boundary \\B Match not beginning/end of word 17 0-1 (Greedy) x? Match 0-1 times greedy 18 0-1 (Lazy) x?? Match 0-1 times lazy 19 >= 0 (Greedy) x* Match 0 or more times greedy 20 >= 0 (Lazy) x*? Match 0 or more times lazy 21 >= 1 (Greedy) x+ Match 1 or more times greedy 22 >= 1 (Lazy) x+? Match 1 or more times lazy 23 Exactly N x{4} Match N times 24 Min-Max x{4,8} Match min-max times 25 > N x{9,} Match N or more times

See also

regex_cheat