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

https://regex101.com/

it returns 0 should.

so why javascript returning -1

remove single quotes around regex

"aktiv landbruger / regler al".search(/regler al/i) 

Comments

Popular posts from this blog

apache - setting document root in antoher partition on ubuntu -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -

Process 'command 'F:\android-sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1 -