\b[012]?[0-5]?[0-9]\.[012]?[0-5]?[0-9]\.[012]?[0-5]?[0-9]\.[012]?[0-5]?[0-9]\b
Update: Forget it, it doesn't work that way: it does not match if the second digit is above 5.
Just use Regexp::Common::net.
(lesson learned (again): don't re-invent the wheel!)
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
In reply to Re: Regular Expression to Match IP Address
by CountZero
in thread Regular Expression to Match IP Address
by sashac88
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |