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.
精彩评论