PHP Regex Any Character

后端 未结 5 655
醉梦人生
醉梦人生 2020-12-10 01:10

The . character in a php regex accepts all characters, except a newline. What can I use to accept ALL characters, including newlines?

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-10 01:40

    would

    [.\n]+
    

    not work?

    How about (.|\n)+? I tested it and it seems to work.

    I am quite sure this is the literal interpretation of exactly what you were asking for.

提交回复
热议问题