Sunday, 15 August 2010

regex - How to validate a list of ipv4 addresses using flex and bison? -


Regex I am using to validate an IPv4 address as follows:

  Dec_octet [0-9] | [1-9] [0-9] | 1 [0-9] [0-9] | 2 [0-4] [0-9] | 25 [0-5] IPv4 address {dec_octet}} \. {Dec_octet} \. {Dec_octet} \. {Dec_octet} %% {IPv4Address} {/ * value returned /}  

Now I want to validate a list of ipv4 addresses. It would be nice if the same regex can be reused in sample input:

  ip = (1.1.1.1.2.2.2.2.3.3.3.3)  

Anything except brackets or coma can be anything. Token lex returns have been given to IPv4 !

"post-text" itemprop = "text">

For a valid IPv4 address, add those rules to the parser file:

  ipv4vector: " Ip '' = '' ('ipv4list') 'ipv4list: ipv4 | Ipv4list ',' ipv4  

No comments:

Post a Comment