Welcome Guest, Not a member yet? Register   Sign In
Regex valid ip
#1

[eluser]Twisted1919[/eluser]
yes i know that this is not the first nor the last discussion about validating an ipv4 address with regex .

Currently i have this pattern :
(On many lines for good reading)

Code:
$pattern = '/^(([1-9](0)?\.|[1-9]{2}\.|(1[0-9][0-9]|2[0-5][0-5])\.)';
$pattern.= '([0-9]{1,2}\.|[1-9]{2}\.|(1[0-9][0-9]|2[0-5][0-5])\.)';
$pattern.= '([0-9]{1,2}\.|[1-9]{2}\.|(1[0-9][0-9]|2[0-5][0-5])\.)';
$pattern.= '([0-9]{1,2}|[1-9]{2}|(1[0-9][0-9]|2[0-5][0-5])))$/';

yes , a long one , so i was wondering if you can help me with something similar that will allow only valid ip addreses but without the help of php , just regex .

I'm sure that must be a way of doing this , but i am just learning regex , and this is all that i could come up with .

Thanks.


Messages In This Thread
Regex valid ip - by El Forum - 07-23-2009, 11:25 AM
Regex valid ip - by El Forum - 07-23-2009, 12:53 PM
Regex valid ip - by El Forum - 07-23-2009, 01:01 PM
Regex valid ip - by El Forum - 07-23-2009, 01:31 PM
Regex valid ip - by El Forum - 07-23-2009, 01:43 PM
Regex valid ip - by El Forum - 07-23-2009, 01:55 PM
Regex valid ip - by El Forum - 07-23-2009, 02:19 PM
Regex valid ip - by El Forum - 07-23-2009, 02:31 PM
Regex valid ip - by El Forum - 07-23-2009, 02:47 PM
Regex valid ip - by El Forum - 07-23-2009, 02:48 PM
Regex valid ip - by El Forum - 07-24-2009, 04:41 AM
Regex valid ip - by El Forum - 07-24-2009, 08:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB