2021年3月31日星期三

Regex matching number of digits

Based off this answer.

I'm trying to match all the ports including g10.

IF-MIB::ifDescr.10 = 1/1/g10, Office to DMZ  IF-MIB::ifDescr.6 = 1/1/g6, Office to DMZ  IF-MIB::ifDescr.4 = 1/1/g4, Office to DMZ  

This is a partial match:

(?:(?<=ifDescr\.\d = )|(?<=ifDescr\.\d\d = ))(?P<ifDescr>((\d\/\d\/g\d))|(\d\/\d\/g\d\d))  

I can't get the 2nd half to match both g6 and g10.

Example here.

https://stackoverflow.com/questions/66898114/regex-matching-number-of-digits April 01, 2021 at 11:39AM

没有评论:

发表评论