What does [\S\s]* mean in regex in PHP?

前端 未结 3 1742
梦如初夏
梦如初夏 2020-12-03 06:24

What is meant by [\\s\\S]* in regex in PHP? Does [\\s\\S]* actually match every string the same as .*?

3条回答
  •  一生所求
    2020-12-03 07:24

    By default . doesn't match new lines - [\s\S] is a hack around that problem.
    This is common in JavaScript, but in PHP you can use the /s flag to to make the dot match all characters.

提交回复
热议问题