开发者

Regex for dashed class names

I have a strings that looks like this:

"wes-1 className Another" "wes-2-bos className Another" "wes-3 className Another" "wes-5-bos className Another"

I need to return the ones that are wes-* and delete everything else.

Regex makes my head spin, any help?

using js. This开发者_运维百科 is what I have so far..

str.match(/\b^wes/);


str.match(/wes-[\w-]*/)

matches wes- and any number of word or - characters after it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜