I’m searching a regex in js to match string doesn’t start with #
the opposite of this function
String.prototype.parseHashtag = function() {
return this.match(/[#]+[A-Za-z0-9-_]+/g);
}
t="#lorem #ipsum yes no";
console.log(t.parseHashtag()); // ["#lorem", "#ipsum"]
I found this Regex: Finding strings that doesn't start with X
but the regex doesn’t work /([^#]|^)[a-z]/ or maybe I’m tired…
I do a replace() but really be curious to understand how to do it in match()!
Here is a js : http://jsfiddle.net/d8HVU/1/
I tried this and is working well for Javascript on your sample input. I hope it is also ok for other inputs. Test it well. The other answers did not work out in Javascript.