Regexp - Look-around group (Assertion) - ( Lookahead | Lookbehind )



Look-around are non-capturing group that implements an assertion.


If you don't find your pattern below, question mark has other functionality in regular expression. See them all at Regular Expression - Question Mark (?)

(?=X) X, positive lookahead (via zero-width)
(?!X) X, negative lookahead (via zero-width)
(?<=X) X, positive lookbehind (via zero-width)
(?<!X) X, negative lookbehind (via zero-width)

where X is a sub-regular expression


Lookahead is typically used to create a logical operator AND between two regular expressions.

For example, if a password must:

  • contain:
    • a lower case letter,
    • an upper case letter,
    • a punctuation symbol,
  • and be at least 6 characters long

then the following expression can be used to validate the password.


Discover More
Compiler - LL parser

An LL(k) parser is a type of parser that build the tree in a top-down way. LR approach It is a top-down parser that parses from left to right, constructs a leftmost derivation of the input ...
Card Puncher Data Processing
Data Validation (Schema Validation)

Data Validation is: the first step in a data processing lifecycle but is also helpful in spam bot protection. To be able to validate, a schema must be available for the data been validated. The...
Lexical Analysis - Parser (Syntax analysis|Linter)

A parser create a parse tree data structure from a series of token created by the lexer. The creation of the tree is based on the rules declared in the grammar (which defines the syntactic structure of...
Multilingual Regular Expression Syntax (Pattern)

Regular expression are Expression that defines a pattern in text. This is therefore a language that permits to define structure of a text. They are a mathematically-defined concept, invented by Stephen...
Regexp - Assertion (Condition)

An assertion is an assertion that specifies a condition that has to be met at a particular point in a match, without consuming any characters from the subject string. simple assertion designed...
Regular Expression - Group (Capture|Substitution)

Construct Definition (? | X, as a named-capturing group | ^ ^^ | (?:X) | X, as a group | | (?>X) | X, as an independent, group | ^ Assertion (See ) ^^ | (?=X) | X, positive lookahead (via zero-width)...
Regular Expression - Question Mark (?)

The question mark (?) in a regular expression has several meanings and may define: a quantifier a lazy match a group name property a look-around (assertion) And to determine what is its meaning,...
Regular expression - Negation

Regular expression is a language that does not have a NOT operator but it has some negative construct ^ will negate the class, ie capture until not this characters Example: matches any character...

Share this page:
Follow us:
Task Runner