Reputation: 1548
The regex which I am using to validate an IPv4 address is as follows:
dec_octet [0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]
IPv4Address {dec_octet}\.{dec_octet}\.{dec_octet}\.{dec_octet}
%%
{IPv4Address} { /* return the value */ }
Now I want to validate a list of ipv4 addresses. It would be good if the same regex can be reused. A Sample input:
ip=(1.1.1.1,2.2.2.2,3.3.3.3)
The delimiters can be anything except brackets or commas. Any help would be appreciated !!
Upvotes: 0
Views: 746
Reputation: 1019
Say IPV4
is the token lex returns for a valid IPv4 address, add those rules in parser file:
ipv4vector:
"ip" '=' '(' ipv4list ')'
ipv4list:
IPV4 | ipv4list ',' IPV4
Upvotes: 2