Regular Expressions 101

Community Patterns

Match ACSS components [main test].

0

Regular Expression
PCRE (PHP <7.3)

/
^#start of line (?![^\n!]*!{2,}) (?=[^_\n]*_[^_]*) #if _ exists, then: ([^_:]+) #mandatory group 1 ((?=:[^:\n]):[^:_(\n]+|) #optional group 2 (_(?!_)) #group 3 mandatory ([^_\-(\n]+) # group 4 mandatory \( #mandatory ( ([^()\n]+) # group 5 mandatory \) #mandatory ) ((?=!)!|) # group 6 optional ((?=:[^!:@\n]):[^!:@\n]+|) # group 7 optional ((?=::[^!:@\n])::[^!:@\n]+|) #group 8 optional ((?=@[^!:@\n])@[^!:@\n]+|) #group 9 optional $ #end of line
/
gmx

Description

Multiline regex for case when combinator is provided.

Submitted by anonymous - 6 years ago