I am trying to match regex for the Fully Qualified Domain Name (fqdn) like this:
1.test02a-d.test.example.net
2.test02b-d.test.example.net
3.test03a.test.example.net
4.test03b.test.example.net
5.test04-d.test.example.net
6.test05.test.example.net
I tried this regex to get the first part of the fqdn:
[^.]+
Criteria: Here I need to get the list of fqdn that has alphabets 'a' or 'b' immediately after number in first part. As shown in the above example 1,2,3,4 matches this condition. i.e., test02a, test02a-d, test 02b and test02b-d
Fqdn 5 and 6 should be ignored as per the above criteria.
How to modify regex for matching this criteria?
Note: This should be used as REGEXP in Mysql and hence some direct javascript regexes didn't work. The solution should be applicable for both javascript and mysql.
[^.-]+.