开发者

Javascript REGEX : Tags

I want to convert words into tags.

So for example I have an input, if I type in in this

apple, windows, stackoverflow, google, microsoft

then I will get this:开发者_开发百科

apple windows stackoverflow google microsoft

Delimiters should be space, semicolon, or comma, just like in stackoverflow :)


You can use the split method to split a string into an array, like this:

var tags = str.split(/\s*[ ,;]\s*/);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜