1

I'm using the boost library for regular expression.

What is the use of "!" mark in the Perl regular expression?

What does it denote?

Unihedron
  • 10,902
  • 13
  • 62
  • 72
BSalunke
  • 11,499
  • 8
  • 34
  • 68
  • Can you show us an example of how you're seeing it used? It means different things in different contexts. – slim Aug 21 '12 at 05:41
  • A suggestion would be to insert your regular expression into http://www.regex101.com/ and read the explanation part. Because it is based on PCRE, much of it can be directly translated to Perl. – Firas Dib Aug 21 '12 at 07:02

1 Answers1

5

By itself it means nothing special, it just matches !. It can be combined with other symbols to mean other things:

  • (?!...) is a negative lookahead - it matches if the following characters do not match the "..." portion
  • (?<!...) is a negative lookbehind - it matches if the preceding characters do not match the "..." portion
porges
  • 30,133
  • 4
  • 83
  • 114