Reputation: 20555
Okay so i have the following string:
Aktiv landbruger / Regler AL
With this string i attempt to run the following regex:
/Regler AL/i
However once i run string.search('/Regler AL/i')
it returns -1
However when i attempt this on
it returns 0
as it should.
So why is my javascript returning -1
Upvotes: 0
Views: 32
Reputation: 41065
Remove the single quotes around the regex
"Aktiv landbruger / Regler AL".search(/Regler AL/i)
Upvotes: 5