允许命名的子模式字符

时间:2011-04-27 17:57:08

标签: php regex escaping preg-match character

命名子模式中允许使用哪些字符,是否可以在命名子模式中进行转义?

(?<name>\w+)

我想使用此示例http://www.php.net/manual/en/function.preg-match.php#example-3946,并希望以“hello-name”代替“name”。

1 个答案:

答案 0 :(得分:5)

PCRE仅允许子图案名称使用字母数字字符和下划线:
http://regexkit.sourceforge.net/Documentation/pcre/pcrepattern.html#SEC14

相关问题