Advertisement
jyoung12387

RegEx Quick Reference Guide

Mar 12th, 2020
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. CHARACTER ESCAPES
  2. \t - Matches a tab
  3. \n - Matches a new line
  4.  
  5. CHARACTER CLASSES
  6. . - Wildcard: Matches any single character except \n.
  7. \d - Matches any decimal digit. (0-9)
  8. \D - Matches any character other than a decimal digit. (0-9)
  9. \w - Word Character (a-z, A-Z, 0-9, _)
  10. \W - Not a Word Character
  11. \s - Matches any white-space character. (space, tab, newline)
  12. \S - Matches any non-white-space character (space, tab, newline)
  13. [character_group] - Matches any single character in character_group. By default, the match is case-sensitive.
  14. [^character_group] - Negation: Matches any single character that is not in character_group. By default, characters in character_group are case-sensitive.
  15.  
  16. ANCHORS
  17. ^ - The match must start at the beginning of the string or line.
  18. $ - The match must occur at the end of the string or before \n at the end of the line or string.
  19. \A - The match must occur at the start of the string.
  20. \Z - The match must occur at the end of the string or before \n at the end of the string.
  21. \b - Word Boundary
  22. \B - Not a Word Boundary
  23.  
  24. ALTERNATION CONSTRUCTS
  25. | - Either Or
  26.  
  27. GROUPING CONSTRUCT
  28. ( ) - Group
  29.  
  30. Quantifiers:
  31. * - Matches the previous element zero or more times.
  32. + - Matches the previous element one or more times.
  33. ? - Matches the previous element zero or one time.
  34. {n} - Matches the previous element exactly n times.
  35. {n,m} - Matches the previous element at least n times, but no more than m times.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement