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

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -