double expression using match function in javascript -


path = google.com/page/4/post.php

and time path google.com/blog/page/ contains string 'page' in url.

path.match(/page/gi) second path true, how skip that?

is this?

if(path.match(/page/gi) && !path.match(/page/gi)){  } 

yes, can use !path.match.

this works understand expected:

if(path.match(/page/gi) && !path.match(/post/gi)){     console.log('no match'); } else {     console.log('match'); } 

jsfiddle


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

Error while updating a record in APEX screen -

c++ - In an add-in in Excel, written in C(++), how does one get the name of the function which called into the addin? -