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'); }
Comments
Post a Comment