delimiter of Regular Expression正则表达式的分隔符


The syntax for patterns used in these functions closely resembles Perl. The expression should be enclosed in the delimiters, a forward slash (/), for example. Any character can be used for delimiter as long as it’s not alphanumeric or backslash (\). If the delimiter character has to be used in the expression itself, it needs to be escaped by backslash. Since PHP 4.0.4, you can also use Perl-style (), {}, [], and <> matching delimiters. See Pattern Syntax for detailed explanation.

摘自php manual

任何非字母,数字和\的字符都可以当做delimiter,好处,估计是可以不和expression里面的字符冲突,比如,如果里面有一个/,那么就用#好了。

知识的力量。


发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据