Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
(?!.*?\/)(?P<image>.*?)(?:\.(?:jpg|png))
/
g

Description

This regex will be getting the name of the image

source: data/products/cocacola/logo_new_version.jpg match: logo_new_version

It will be returned logo_new_version on image index

Submitted by strubloid - 8 years ago