I am trying to extract router names from syslog messages.
Need the regular expression to get the first 7 or 8 characters of variable length strings that end with abcd.com. Example below:
tpbjm01-re0.abcd.com
xtsdjm01-re0.abcd.com
lnd2j902-re1.abcd.com
pqrjm02-re1.abcd.com
py3jm01-re1.uk.abcd.com
brhmjm02-re1.emea.abcd.com
rcnj902.abcd.com
cpzyjm01.abcd.com
So result should be:
tpbjm01
xtsdjm01
lnd2j902
pqrjm02
py3jm01
brhmjm02
rcnj902
cpzyjm01
This is supposed to be the correct regex but it is not pulling anything:
^(?\w{7,8})(?=.*abcd.com)
↧