in reply to Regex for IP and Optional Port
For completeness' sake, following is the final regex:
( # $1 - first IP \d{1,3} # 1-3 digits (?: # grouping for rep count \. # dot \d{1,3} # 1-3 digits ){3} # three more times (?: # optional extra grouping \/ # a slash \d+ # 1st port number )? # close extra grouping ) # close group around 1st IP [ # set up character class \s # whitespace a-zA-Z # letters \W # non-word characters ]+ # end character class ( # $2 - 2nd IP \d{1,3} # 1-3 digits (?: # grouping for rep count \. # dot \d{1,3} # 1-3 digits ){3} # three more times (?: # optional extra grouping \/ # a slash \d+ # 2nd port number )? # close extra grouping ) # close group around 2nd IP /x ) # specify /x
Thanks again!
Update: Fiddled with the grammer.
If things get any worse, I'll have to ask you to stop helping me.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regex for IP and Optional Port
by spaz (Pilgrim) on Jan 17, 2002 at 04:03 UTC |