So, I have a keyword field (yes, type is keyword as well, not just the name) that I want to match against MAC addresses.
The field contains just the MAC address and nothing else, so anchoring is not a problem.
Yes, your version indeed works. Which leaves me kinda puzzled. The only difference is that I have a set of separators ('-' and ': ') and you are using just colons. So actually you don't even have to use a set and could simplify it to ([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}) .
Anyways, I don't understand why my regex wouldn't work, Perl compliant or not.
Your original one may not have worked because of the - in the range. The regex engine may have thought that was indicating a range (like [0-9]) instead of just a character.
If you want to match special characters, you need to escape them with (I think) a \. Try [:\-], or maybe even just have the - as the first character in the group so the engine may not consider it as a range identifier ([-:]).
I haven't tested these - it's just based on experience.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.