【发布时间】:2014-12-09 06:54:43
【问题描述】:
I want modify my regular expression to also remove @ size but select only that word those are start with @ sign.
以下是我的代码,查看 Live
JS
var a = "@abc @jat hi pat @jkl abc @cde vcd @cde ";
var s = a.match(/(?=(\s{1}?@[^\s]+)|(\s?))(@[^\s]+)(?=(\s))/g);
console.log(s);
结果
["@abc", "@jat", "@jkl", "@cde", "@cde"]
预期结果
["abc", "jat", "jkl", "cde", "cde"]
【问题讨论】:
标签: javascript regex regex-negation