Regular Expressions 101

Community Patterns

There does not seem to be anything here

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^([^_\n]+)(?(?=_)|(?=\.jpg))
/
mg

Description

Another rendition of the previous expression, without the lazy quantification. Here, the expression will match any character except for the underscore character, so if there is an underscore, it will stop and evaluate the lookahead.

I wonder which one is faster

Submitted by anonymous - 3 years ago