Community Patterns

Community Library Entry

0

Regular Expression
Created·2023-06-05 06:23
Flavor·PCRE2 (PHP)

/
Chr\.(I(?!I)|III(?!I))
/
gm
Open regex in editor

Description

From the following:

Chr.
Chr.I
Chr.II
Chr.III
Chr.IIV
Chr.IIII.I

I only want to select Chr.I and Chr.III. One solution to this is using negative lookahead, which excludes certain follow-up characters once our string-of-interest is satisfied.

This is the regex: Chr\.(I(?!I)|III(?!I))

Submitted by dikip