我有一个字符串,看起来像这样:
"wes-1 className Another“"wes-2-bos className Another”"wes-3 className Another“"wes-5-bos className Another”
我需要返回wes-*,并删除其他所有内容。
Regex让我头晕,有什么帮助吗?
使用js。这就是我到目前为止所拥有的。
str.match(/\b^wes/);发布于 2011-08-27 10:27:00
str.match(/wes-[\w-]*/)匹配wes-以及其后任意数量的单词或-字符。
https://stackoverflow.com/questions/7212135
复制相似问题