Regex for Hostname

I’ve been working on updating our automatic tag rules for a current project and would like to use Regex to capture a device type from a dns name, i.e. ABCCORE01.TEST.COM.  The ABC prefix is the location of the device, and CORE is the device type.  I would like to only use the device type as an optional tag value, such as “Device Capability: <value>”.  I’m sure this is nothing new.

This worked in regex101, but not in DT…

^[a-zA-Z0-9]{0,3}([a-zA-Z]+?)\d

The location prefix can be ABC or AB1.

you can try this one, {Host:DetectedName/^AB[C0-9]([^.]*+).*$/$1/}

Please check Regular expressions in Dynatrace — Dynatrace Docs

From my experience: pick the ungreedy option to test in regex101


 
with ^[A-Za-z0-9]{3}([A-Za-z]+?)\d+\.