msn email google-talk twitter tumblr flickr

Regex quick reference 正则表达式备忘

备忘笔记

   1  [abc] A single character: a, b or c
   2  [^abc] Any single character but a, b, or c
   3  [a-z] Any single character in the range a-z
   4  [a-zA-Z] Any single character in the range a-z or A-Z
   5  ^ Start of line
   6  $ End of line
   7  \A Start of string
   8  \z End of string
   9  . Any single character
  10  \s Any whitespace character
  11  \S Any non-whitespace character
  12  \d Any digit
  13  \DAny non-digit
  14  \w Any word character (letter, number, underscore)
  15  \W Any non-word character
  16  \b Any word boundary character
  17  (...) Capture everything enclosed
  18  (a|b) a or b
  19  a? Zero or one of a
  20  a* Zero or more of a
  21  a+ One or more of a
  22  a{3} Exactly 3 of a
  23  a{3,} 3 or more of a
  24  a{3,6} Between 3 and 6 of a

options:

   1  i case insensitive    
   2  m make dot match newlines    
   3  x ignore whitespace in regex    
   4  o perform #{...} substitutions only once