Wednesday, May 1, 2013

Regular Expression


Lookahead

  • q(?=u)  : quit
  • q(?!u)  : qtip  not quit


LookBehind

  • (?<=a)b  :  abc
  • (?<!a)b  :  xbc not ab



  • ^ matches at the start of the string
  • $ matches at the end of the string
  • \d matches a single character that is a digit
  • \w matches a "word character" (alphanumeric characters plus underscore)
  • \s matches a whitespace character
  • The dot matches a single character, except line break characters. It is short for [^\n] (UNIX regex flavors) or[^\r\n] (Windows regex flavors).gr.y matches graygreygr%y, etc.

No comments:

Post a Comment