亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - The regular expression w only matches one letter. If you want to match a word, how do you write it?
習(xí)慣沉默
習(xí)慣沉默 2017-06-30 09:57:25
0
4
814
var reg = new RegExp('\w');
var match = reg.exec('/hello/world/1');
console.log(match[0]); 

The above log prints h. If you want to print hello, how do you do it?

習(xí)慣沉默
習(xí)慣沉默

reply all(4)
過去多啦不再A夢
var reg = new RegExp('\b\w+\b');
var match = reg.exec('/hello/world/1');
console.log(match[0]); 

b Match the beginning or end of a word.

黃舟

var pattern = /hello/;

var str = "helloword";
console.log(pattern.exec(str)[0]);

Recommend you this website http://www.runoob.com/regexp/...

Peter_Zhu

First w matches the literal value w
wmatches the characters appearing in the word, such as a to z and _
If you need to match multiple

  • You can add * at the end to indicate 0 or more

  • You can add + at the end to indicate one or more

漂亮男人
/[a-zA-Z]*/
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template