Javascript Regular Expression “Single Space Character”

前端 未结 4 1923
礼貌的吻别
礼貌的吻别 2020-12-09 01:49

I am learning javascript and I am analyzing existing codes.

In my JS reference book, it says to search on a single space use \"\\s\"?

But I have

4条回答
  •  遥遥无期
    2020-12-09 02:29

    In addition to normal spaces, \s matches different kinds of white space characters, including tabs (and possibly newline characters, according to configuration). That said, matching with a normal space is certainly valid, especially in your case where it seems you want to match a name, which is normally separated by a normal space.

提交回复
热议问题