I want to validate number in range of 0-255
I have this expression
'/^([0-1]?[0-9]?[0-9])|([2][0-4][0-9])|(25[0-5])$/'
But this accepts any number... And this works:
'/(^[0-1]?[0-9]?[0-9]$)|(^[2][0-4][0-9]$)|(^25[0-5]$)/'
why do I have to have ^ and $ for each option?
edit: I have it, but I cannot answer my question, so - ^
and $
have higher priority than |
, so /^(...)$/
helped