How to match uppercase word character with regex in PHP?

前端 未结 2 713
甜味超标
甜味超标 2020-12-21 07:41

I know there is the [A-Z] notation.. but I am not sure if [a-z] is the same as \\w.

I\'d like to match \\w

2条回答
  •  执笔经年
    2020-12-21 08:18

    You can use Unicode character properties. For example,

    '/\p{Lu}/u'
    

    Will match any uppercase letter.

提交回复
热议问题