You can use String.match()
:
var res = string.match(/<something>/g); // ["<something>"]
If there is no match, the value of res
will be null
. See example on JSFiddle.
0
solved regular expression in javascript checking for “asdasd
You can use String.match()
:
var res = string.match(/<something>/g); // ["<something>"]
If there is no match, the value of res
will be null
. See example on JSFiddle.
0
solved regular expression in javascript checking for “asdasd