命名子模式中允许使用哪些字符,是否可以在命名子模式中转义?
(?<name>\w+)
我想用这个例子http://www.php.net/manual/en/function.preg-match.php#example-3946并希望使用“hello-name”而不是“name”。
最佳答案
PCRE 只允许字母数字字符和下划线作为子模式名称:
http://regexkit.sourceforge.net/Documentation/pcre/pcrepattern.html#SEC14
关于php - 允许的命名子模式字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5808435/