RegexCheatSheet: Align automatically this time.

master
Jag Talon 2013-12-24 17:20:30 -05:00
parent 945bde9baf
commit f4937bd29c
1 changed files with 76 additions and 76 deletions

View File

@ -89,84 +89,84 @@ our %categories = (
# Symbols and their explanation/description
our %syntax_map = (
'.' => 'Any character except newline (\n)',
'(a|b)' => 'a or b',
'(...)' => 'Group',
'(?:...)' => 'Passive (non-capturing) group',
'[abc]' => 'Single character (a or b or c)',
'[^abc]' => 'Single character (not a or b or c)',
'[a-q]' => 'Single character range (a or b ... or q)',
'[A-Z]' => 'Single character range (A or B ... or Z)',
'[0-9]' => 'Single digit from 0 to 9',
'^' => "Start of string or line",
'\A' => "Start of string",
'$' => "End of string or line",
'\Z' => "End of string",
'\b' => 'Word boundary',
'\B' => 'Not word boundary',
'\<' => 'Start of word',
'\>' => 'End of word',
'\c' => 'Control character',
'\s' => 'Whitespace',
'\S' => 'Not Whitespace',
'\d' => 'Digit',
'\D' => 'Not digit',
'\w' => 'Word',
'\W' => 'Not Word',
'\x' => 'Hexadecimal digit',
'\O' => 'Octal Digit',
'[:upper:]' => 'Uppercase letters [A-Z]',
'[:lower:]' => 'Lowercase letters [a-z]',
'[:alpha:]' => 'All letters [A-Za-z]',
'[:alnum:]' => 'Digits and letters [A-Za-z0-9]',
'[:digit:]' => 'Digits [0-9]',
'[:xdigit:]'=> 'Hexadecimal digits [0-9a-f]',
# '[:punct:]' => 'Punctuation [\]\[!"#$%&'."'".'()*+,./:;<=>?@\^_`{|}~-]',
'[:punct:]' => 'Punctuation',
'[:blank:]' => 'Space and tab [ \t]',
'[:space:]' => 'Blank characters [ \t\r\n\v\f]',
'[:cntrl:]' => 'Control characters [\x00-\x1F\x7F]',
'[:graph:]' => 'Printed characters [\x21-\x7E]',
'[:print:]' => 'Printed characters and spaces [\x20-\x7E]',
'[:word:]' => 'Digits, letters and underscore [A-Za-z0-9_]',
'.' => 'Any character except newline (\n)',
'(a|b)' => 'a or b',
'(...)' => 'Group',
'(?:...)' => 'Passive (non-capturing) group',
'[abc]' => 'Single character (a or b or c)',
'[^abc]' => 'Single character (not a or b or c)',
'[a-q]' => 'Single character range (a or b ... or q)',
'[A-Z]' => 'Single character range (A or B ... or Z)',
'[0-9]' => 'Single digit from 0 to 9',
'^' => "Start of string or line",
'\A' => "Start of string",
'$' => "End of string or line",
'\Z' => "End of string",
'\b' => 'Word boundary',
'\B' => 'Not word boundary',
'\<' => 'Start of word',
'\>' => 'End of word',
'\c' => 'Control character',
'\s' => 'Whitespace',
'\S' => 'Not Whitespace',
'\d' => 'Digit',
'\D' => 'Not digit',
'\w' => 'Word',
'\W' => 'Not Word',
'\x' => 'Hexadecimal digit',
'\O' => 'Octal Digit',
'[:upper:]' => 'Uppercase letters [A-Z]',
'[:lower:]' => 'Lowercase letters [a-z]',
'[:alpha:]' => 'All letters [A-Za-z]',
'[:alnum:]' => 'Digits and letters [A-Za-z0-9]',
'[:digit:]' => 'Digits [0-9]',
'[:xdigit:]' => 'Hexadecimal digits [0-9a-f]',
# '[:punct:]' => 'Punctuation [\]\[!"#$%&'."'".'()*+,./:;<=>?@\^_`{|}~-]',
'[:punct:]' => 'Punctuation',
'[:blank:]' => 'Space and tab [ \t]',
'[:space:]' => 'Blank characters [ \t\r\n\v\f]',
'[:cntrl:]' => 'Control characters [\x00-\x1F\x7F]',
'[:graph:]' => 'Printed characters [\x21-\x7E]',
'[:print:]' => 'Printed characters and spaces [\x20-\x7E]',
'[:word:]' => 'Digits, letters and underscore [A-Za-z0-9_]',
'?=' => 'Lookahead assertion',
'?!' => 'Negative lookahead',
'?<=' => 'Lookbehind assertion',
'?!= or ?<!'=> 'Negative lookbehind',
'?>' => 'Once-only Subexpression',
'?()' => 'Condition [if then]',
'?()|' => 'Condition [if then else]',
'?#' => 'Comment',
'*' => '0 or more',
'+' => '1 or more',
'?' => '0 or 1 (optional)',
'{3}' => 'Exactly 3',
'{3,}' => '3 or more',
'{2,5}' => '2, 3, 4 or 5',
'\\' => 'Escape following character',
'\Q' => 'Begin literal sequence',
'\E' => 'End literal sequence',
'\n' => 'New line',
'\r' => 'Carriage return',
'\t' => 'Tab',
'\v' => 'Vertical tab',
'\f' => 'Form feed',
'\ooo' => 'Octal character ooo',
'\xhh' => 'Hex character hh',
'//g' => 'Global Match (all occurrences)',
'//i' => 'Case-insensitive',
'//m' => 'Multiple line',
'//s' => 'Treat string as single line',
'//x' => 'Allow comments and whitespace',
'//e' => 'Evaluate replacement',
'//U' => 'Ungreedy pattern',
'$n' => 'n-th non-passive group',
'$2' => '"xyz" in /^(abc(xyz))$/',
'$1' => '"xyz" in /^(?:abc)(xyz)$/',
'$`' => 'Before matched string',
'?!' => 'Negative lookahead',
'?<=' => 'Lookbehind assertion',
'?!= or ?<!' => 'Negative lookbehind',
'?>' => 'Once-only Subexpression',
'?()' => 'Condition [if then]',
'?()|' => 'Condition [if then else]',
'?#' => 'Comment',
'*' => '0 or more',
'+' => '1 or more',
'?' => '0 or 1 (optional)',
'{3}' => 'Exactly 3',
'{3,}' => '3 or more',
'{2,5}' => '2, 3, 4 or 5',
'\\' => 'Escape following character',
'\Q' => 'Begin literal sequence',
'\E' => 'End literal sequence',
'\n' => 'New line',
'\r' => 'Carriage return',
'\t' => 'Tab',
'\v' => 'Vertical tab',
'\f' => 'Form feed',
'\ooo' => 'Octal character ooo',
'\xhh' => 'Hex character hh',
'//g' => 'Global Match (all occurrences)',
'//i' => 'Case-insensitive',
'//m' => 'Multiple line',
'//s' => 'Treat string as single line',
'//x' => 'Allow comments and whitespace',
'//e' => 'Evaluate replacement',
'//U' => 'Ungreedy pattern',
'$n' => 'n-th non-passive group',
'$2' => '"xyz" in /^(abc(xyz))$/',
'$1' => '"xyz" in /^(?:abc)(xyz)$/',
'$`' => 'Before matched string',
q{$'} => 'After matched string',
'$+' => 'Last matched string',
'$&' => 'Entire matched string',
'$+' => 'Last matched string',
'$&' => 'Entire matched string',
);
sub are_valid_char_classes($$) {