Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allowed named subpattern characters

What characters are allowed in named subpattern and is it possible to escape inside named subpattern?

(?<name>\w+)

I want to use this example http://www.php.net/manual/en/function.preg-match.php#example-3946 and want to have "hello-name" instead of "name" for example.

like image 685
Codler Avatar asked Jul 15 '26 18:07

Codler


1 Answers

PCRE only allows alphanumeric characters and underscores for subpattern names:
http://regexkit.sourceforge.net/Documentation/pcre/pcrepattern.html#SEC14

like image 183
mario Avatar answered Jul 18 '26 08:07

mario