ab1-cde23-fg45-h6-ijk-789.lmn.local. 86400 IN A 12.34.5.123
In the next DNS record, I am trying to map the h6 partition (position 4). At the moment, I know that this domain section consists of only two letters / numbers or one at a time, so I can match it (awkwardly) with
"-[a-zA-Z0-9]{2}-"
In the case when I could not assume that this is the only domain section with two letters / numbers, how can I compare only the contents of the 4th position minus - ? ( ab1 - first position, cde23 second, etc. with all positions divided by - )
I can match 4 positions with the following regex, but it includes everything from the start.
"([a-zA-Z0-9]*-){3}[a-zA-Z0-9]*-"
I am using regexp tags in golang.
source share