Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.07 KB | None | 0 0
  1. Characters
  2. x The character x
  3. \\ The backslash character
  4. \0n The character with octal value 0n (0 <= n <= 7)
  5. \0nn The character with octal value 0nn (0 <= n <= 7)
  6. \0mnn The character with octal value 0mnn (0 <= m <= 3, 0 <= n <= 7)
  7. \xhh The character with hexadecimal value 0xhh
  8. \uhhhh The character with hexadecimal value 0xhhhh
  9. \t The tab character ('\u0009')
  10. \n The newline (line feed) character ('\u000A')
  11. \r The carriage-return character ('\u000D')
  12. \f The form-feed character ('\u000C')
  13. \a The alert (bell) character ('\u0007')
  14. \e The escape character ('\u001B')
  15. \cx The control character corresponding to x
  16.  
  17. Character classes
  18. [abc] a, b, or c (simple class)
  19. [^abc] Any character except a, b, or c (negation)
  20. [a-zA-Z] a through z or A through Z, inclusive (range)
  21. [a-d[m-p]] a through d, or m through p: [a-dm-p] (union)
  22. [a-z&&[def]] d, e, or f (intersection)
  23. [a-z&&[^bc]] a through z, except for b and c: [ad-z] (subtraction)
  24. [a-z&&[^m-p]] a through z, and not m through p: [a-lq-z](subtraction)
  25.  
  26. Predefined character classes
  27. . Any character (may or may not match line terminators)
  28. \d A digit: [0-9]
  29. \D A non-digit: [^0-9]
  30. \s A whitespace character: [ \t\n\x0B\f\r]
  31. \S A non-whitespace character: [^\s]
  32. \w A word character: [a-zA-Z_0-9]
  33. \W A non-word character: [^\w]
  34.  
  35. POSIX character classes (US-ASCII only)
  36. \p{Lower} A lower-case alphabetic character: [a-z]
  37. \p{Upper} An upper-case alphabetic character:[A-Z]
  38. \p{ASCII} All ASCII:[\x00-\x7F]
  39. \p{Alpha} An alphabetic character:[\p{Lower}\p{Upper}]
  40. \p{Digit} A decimal digit: [0-9]
  41. \p{Alnum} An alphanumeric character:[\p{Alpha}\p{Digit}]
  42. \p{Punct} Punctuation: One of !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
  43. \p{Graph} A visible character: [\p{Alnum}\p{Punct}]
  44. \p{Print} A printable character: [\p{Graph}\x20]
  45. \p{Blank} A space or a tab: [ \t]
  46. \p{Cntrl} A control character: [\x00-\x1F\x7F]
  47. \p{XDigit} A hexadecimal digit: [0-9a-fA-F]
  48. \p{Space} A whitespace character: [ \t\n\x0B\f\r]
  49.  
  50. java.lang.Character classes (simple java character type)
  51. \p{javaLowerCase} Equivalent to java.lang.Character.isLowerCase()
  52. \p{javaUpperCase} Equivalent to java.lang.Character.isUpperCase()
  53. \p{javaWhitespace} Equivalent to java.lang.Character.isWhitespace()
  54. \p{javaMirrored} Equivalent to java.lang.Character.isMirrored()
  55.  
  56. Classes for Unicode blocks and categories
  57. \p{InGreek} A character in the Greek block (simple block)
  58. \p{Lu} An uppercase letter (simple category)
  59. \p{Sc} A currency symbol
  60. \P{InGreek} Any character except one in the Greek block (negation)
  61. [\p{L}&&[^\p{Lu}]] Any letter except an uppercase letter (subtraction)
  62.  
  63. Boundary matchers
  64. ^ The beginning of a line
  65. $ The end of a line
  66. \b A word boundary
  67. \B A non-word boundary
  68. \A The beginning of the input
  69. \G The end of the previous match
  70. \Z The end of the input but for the final terminator, if any
  71. \z The end of the input
  72.  
  73. Greedy quantifiers
  74. X? X, once or not at all
  75. X* X, zero or more times
  76. X+ X, one or more times
  77. X{n} X, exactly n times
  78. X{n,} X, at least n times
  79. X{n,m} X, at least n but not more than m times
  80.  
  81. Reluctant quantifiers
  82. X?? X, once or not at all
  83. X*? X, zero or more times
  84. X+? X, one or more times
  85. X{n}? X, exactly n times
  86. X{n,}? X, at least n times
  87. X{n,m}? X, at least n but not more than m times
  88.  
  89. Possessive quantifiers
  90. X?+ X, once or not at all
  91. X*+ X, zero or more times
  92. X++ X, one or more times
  93. X{n}+ X, exactly n times
  94. X{n,}+ X, at least n times
  95. X{n,m}+ X, at least n but not more than m times
  96.  
  97. Logical operators
  98. XY X followed by Y
  99. X|Y Either X or Y
  100. (X) X, as a capturing group
  101.  
  102. Back references
  103. \n Whatever the nth capturing group matched
  104.  
  105. Quotation
  106. \ Nothing, but quotes the following character
  107. \Q Nothing, but quotes all characters until \E
  108. \E Nothing, but ends quoting started by \Q
  109.  
  110. Special constructs (non-capturing)
  111. (?:X) X, as a non-capturing group
  112. (?idmsux-idmsux) Nothing, but turns match flags i d m s u x on - off
  113. (?idmsux-idmsux:X) X, as a non-capturing group with the given flags i d m s u x on - off
  114. (?=X) X, via zero-width positive lookahead
  115. (?!X) X, via zero-width negative lookahead
  116. (?<=X) X, via zero-width positive lookbehind
  117. (?<!X) X, via zero-width negative lookbehind
  118. (?>X) X, as an independent, non-capturing group
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement