ab1-cde23-fg45-h6-ijk-789.lmn.local. 86400 IN A 12.34.5.123
In the follow DNS entry, I'm trying to match the h6
section (position 4). At this point, I know this section of the domain is only composed of 2 letters/digits or one of each, so I can match it (in a clumsy way) with
"-[a-zA-Z0-9]{2}-"
In a case where I could not assume that this is the only section of a domain with 2 letters/digits, how could I match only the content of the 4th position minus the -
? (ab1
being the first position, cde23
the second, and so on, with all the positions separated by -
)
I'm able to match up to the 4th positions with the following regex, but it includes everything from the start.
"([a-zA-Z0-9]*-){3}[a-zA-Z0-9]*-"
I'm using theses regexp in golang.