Contents

  Icon

Look around assertions

Anchors

Basic metacharacters

Character classes

Comments

Control and code

Grouping

Look around

Mode modifiers

Quantifiers

Specific characters

These non capturing, groups do not consume any part of the string. They just look ahead or back to see if the expression between the parentheses is true or false.

Lookbehind assertions can only contain expressions with a fixed with, because they need to know at what point backwards in the string they have to start looking.


 

Item

 

Meaning:

 
 

(?=…)

 

Positive lookahead.
True if the expression between the parentheses matches.

 
 

(?!…)

 

Negative lookahead.
False if the expression between the parentheses matches.

 
 

(?<=…)

 

Positive lookbehind.
True if the expression between the parentheses matches.

 
 

(?<!…)

 

Negative lookahead.
False if the expression between the parentheses matches.

 
 

In the table “…” stands for any one or more characters.