Regular Expressions 101

Community Patterns

potential react or next component names from folder name

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^(?:(?<caml>\w+(?:\-\w+)+)|\[(?<with>[a-z\d-]+)(?<qualify>.+)\]|\[{1,2}\.{3}(?<all>[\w\-]+)\]{1,2}|\((?<group>[\w\-]+)\)|(?<reserved>[@_][\w\-]+)|(?<same>\.)|(?:(?<subpath>(?:(?:[\/\\][^\/\\]+)+[\/\\])|[\/\\])(?<nested>[^\\\/]+)))$
/
m

Description

this regex can be used to generate a potential component name out of a folder name NEXT js complient

Submitted by Jean Luc Emmanuel VERHANNEMAN - 17 days ago