I don't have much experience with JavaScript but i'm trying to create a tag system which, instead of using @
or #
, would use /
.
var start = /#/ig; // @ Match
var word = /#(\w+)/ig; //@abc Match
How could I use a /
instead of the #
. I've tried doing var slash = '/'
and adding + slash +
, but that failed.
This question is related to
javascript
regex
You can escape it like this.
/\//ig; // Matches /
or just use indexOf
if(str.indexOf("/") > -1)