regular expression pattern to accept one or multiple ip addresses?

后端 未结 5 2133
太阳男子
太阳男子 2021-01-17 01:20

I am using below regular expression pattern

pattern=\"^(\\d|[1-9]\\d|1\\d\\d|2([0-4]\\d|5[0-5]))\\.(\\d|[1-9]\\d|1\\d\\d|2([0-4]\\d|5[0-5]))\\.(\\d|[1-9]\\d         


        
5条回答
  •  醉酒成梦
    2021-01-17 01:29

    ([1-9]\d?\d?(\.\d{1,3}){2}\.\d{1,3},?)+
    

    A little over Reductionist perhaps, but that should handle it. (you will need to trim out the commas from the matches though) Edited to restrict matches to the range of 1...* -> 999...*

提交回复
热议问题