JavaScript regex returns -1 when > 0 is expected -
okay have following string:
aktiv landbruger / regler al
with string attempt run following regex:
/regler al/i
however once run string.search('/regler al/i')
it returns -1
however when attempt on
it returns 0
should.
so why javascript returning -1
remove single quotes around regex
"aktiv landbruger / regler al".search(/regler al/i)
Comments
Post a Comment