In below code I have REGEX.
This REGEX allows me to “filter-out” a specific type of “tags” I have.
For example… tag “Hello” is treated differently (in CSS styling) than tag “Ciao (IT)”.
This all works well, no problem there, all good.
if(tag.name.match(/[a-zA-Z0-9]+\s*\([a-zA-Z0-9]+\)/)) {
result.pop(
'<a href="' + self.url_for(tag.path) + '" style="' + style + '">' +
'</a>'
);
} else {
result.push(
'<a href="' + self.url_for(tag.path) + '" style="' + style + '">' +
'</a>'
);
}
In another file I have “IF” statement…
if (page.tag)
do something
In above statement I need to incorporate my REGEX also, and I tried something like this:
if (page.tag(/[a-zA-Z0-9]+\s*\([a-zA-Z0-9]+\)/))
do something
But that does not work.
Question is how to incorporate REGEX in above statement that makes it work?