Regular Expressions 101

Community Patterns

PHP Project HTML select

0

Regular Expression
PCRE (PHP <7.3)

/
^(?!.*(vendor|node_modules)).*\.html?
/
g

Description

Takes a list of files in a PHP project, and, when run on each file path, ensures that it only selects HTML files created by the project. Useful for Percy builds and such. E.G:

node_modules/index.html returns False index.html returns True test.php returns False

Submitted by StellarDoor5319 - 7 years ago