Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Python

r"
(?i)(?=(((\()?(red|gold|silver|king)( pack)?(\))?)|((70|83|84|100|120)(s|'s)?)))((((\()?(red|gold|silver|king)( pack)?(\))? )?((70|83|84|100|120)(s|'s)? )?)(\bbox\b))
"
gm

Description

Python does not support conditionals using lookaround, even though Python does support lookaround outside conditionals. (?(?=regex) then|else) is illegal in python (?=regex)then|(?!regex)else - this works. madness

details in the test strings

Submitted by PeteC - 3 years ago