racingrails

Symbols Regular Expressions

Dec 21st, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. ^ |Anchor for the beginning of a line
  2. $ |Anchor for the end of a line
  3. \A |Anchor for the start of a string
  4. \Z |Anchor for the end of a string
  5. . |Any character
  6. \w |Any letter, digit, or underscore
  7. \W |Anything that \w doesn't match
  8. \d |any digit
  9. \D |anything that \d doesn't match- non digits
  10. \s |Whitespace such as spaces, tabes, newlines, and so on
  11. \S |non whitespace - any visible character
  12.  
  13. Character and sub-expression modifiers
  14. * |Match zero or more occurrences of the preceding character, and match as many as possible
  15. + |Match one or more occurrences of the preceding character, and match as many as possible
  16. *? |Match zero or more occurrences of the preceding character, and match as few as possible
  17. +? |Match one or more occurrences of the preceding character, and match as few as possible
  18. ? |Match either one or none of the preceding character
  19. {x} |Match x occurrences of the preceding character
  20. {x,y} |Match at least x occurrences and at most y occurrences
Advertisement
Add Comment
Please, Sign In to add comment