I'm trying to add css to a div, when the website have /category
or /blog
in url.
follows my code:
var expression = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi;
var regex = new RegExp(expression);
var paths = ['/blog', '/category'];
for (i = 0; i < paths.length; i++) {
if (paths[i].match(regex) )
{
console.log("Successful match");
$('.page-title').css('bottom', '-100px');
} else {
console.log("No match");
}
}
The problem is this return false always, seems to don't getting just the /blog
or /category
i need to put the css just when have this two parts in url, I think this regex is wrong or something is missing, someone can help?