PHP regex delimiters, / vs. | vs. {} , what are the differences?

后端 未结 2 611
孤城傲影
孤城傲影 2020-12-19 08:59

In the PHP manual of PCRE, http://us.php.net/manual/en/pcre.examples.php, it gives 4 examples of valid patterns:

  • /<\\/\\w+>/
2条回答
  •  时光说笑
    2020-12-19 09:31

    In fact you can use any non alphanumeric delimiter (excluding whitespaces and backslashes)

    "%^[a-z]%"
    

    works as well as

    "*^[a-z]*"
    

    as well as

    "!^[a-z]!"
    

提交回复
热议问题