I need to check for classname in a string.
My string looks like this:
testing ui-li ui-li-static ui-btn-up-f ui-first-child ui-filter-hidequeue
And I'm looking for ui-filter-hidequeue
anywhere (!) in the string.
This is what I'm trying. It always returns null
, althought the string I'm trying to match is there:
var classPassed = 'ui-filter-hidequeue',
classes = 'testing ui-li ui-li-static ui-btn-up-f ui-first-child ui-filter-hidequeue',
c = new RegExp('(?:\s|^)' + classPassed + '(?:\s|$)');
console.log( classes.match(c) ) // returns null
Question:
Can someone tell me what I'm doing wrong in my regex?
Thanks!