My code generates tags
.
For example:
- hello
- bye
- ciao
- bonjour (FR)
- sayonara (JP)
With regex
did I define those tags
that have brackets (so these tags: “bonjour (FR)” and “sayonara (JP)” in above example.
Here the code (this code shows ALL tags):
if(tag.name.match(/[a-zA-Z0-9]+\s*\([a-zA-Z0-9]+\)/)) {
result.push(
'<a href="' + self.url_for(tag.path) + '" style="' + style + '">' +
'</a>'
);
What I want to achieve is:
- Show only those tags with the regex code that has “xxxxx (yy)”, “aaaa (bb)”. So the other ones NOT (for example, “hello”, “ciao”, etc.). = widget-one
- Show only those tags for which the regex does NOT apply, so these tags “hello”, “ciao”, etc. = widget-two.
I was messing around with .split
but I could only split within the tag itself. Not between my “two types” of tags
. How to do it?