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

Regexp

About

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

List

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

Assertion
(?=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

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.

(?=.*[[:lower:]])(?=.*[[:upper:]])(?=.*[[:punct:]]).{6,}





Discover More
Compiler
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...
Compiler
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...
Regexp
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
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...
Regexp
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)...
Regexp
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,...
Regexp
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