javascript - Excluding URLS that contain a string in Regex -


i using regex add survey pages , want include on pages except payment , signin pages. can't use arounds regex attempting use following isn't working.

^/.*[^(credit|signin)].* should capture urls except containing credit or signin

[ indicates start of character class , [^ negation per-character. regular expression "anything followed character not in class followed anything," match anything.

since using specific strings, don't think regular expression appropriate here. lot simpler check credit , signin don't exist in string, such javascript:

-1 === string.indexof("credit") && -1 === string.indexof("signin") 

or check regular expression not match

false === /credit|signin/.test(string) 

Comments

Popular posts from this blog

python 3 IndexError: list index out of range -

android - How to save instance state of selected radiobutton on menu -

IF statement in MySQL trigger -