Re: regexp matching nummeric ranges

2010-12-13 Thread Randal L. Schwartz
> ""Kammen" == "Kammen van, Marco, Springer SBM NL" > writes: Kammen> What am I doing wrong?? Using a regex when something else would be much better. Stop trying to pound a nail in with a wrench handle. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 h

Re: regexp matching nummeric ranges

2010-11-30 Thread Rob Dixon
On 30/11/2010 06:39, Uri Guttman wrote: "GK" == Guruprasad Kulkarni writes: GK> Here is another way to do it: GK> /^127\.0\.0\.([\d]|[1-9][\d]|[1][\d][\d]|[2]([0-4][\d]|[5][0-4]))$/) { why are you putting single chars inside a char class? [\d] is the same as \d and [1] is just 1. A

Re: regexp matching nummeric ranges

2010-11-29 Thread John W. Krahn
Rob Dixon wrote: On 29/11/2010 23:46, John W. Krahn wrote: As Rob said [2..254] is a character class that matches one character (so "127.0.0.230" should match also.) You also don't anchor the pattern so something like '765127.0.0.273646' would match as well. What you need is something like thi

Re: regexp matching nummeric ranges

2010-11-29 Thread Uri Guttman
> "GK" == Guruprasad Kulkarni writes: GK> Here is another way to do it: GK> /^127\.0\.0\.([\d]|[1-9][\d]|[1][\d][\d]|[2]([0-4][\d]|[5][0-4]))$/) { why are you putting single chars inside a char class? [\d] is the same as \d and [1] is just 1. also please don't quote entire emails below

RE: regexp matching nummeric ranges

2010-11-29 Thread Kammen van, Marco, Springer SBM NL
>-Original Message- >From: John W. Krahn [mailto:jwkr...@shaw.ca] >Sent: Tuesday, November 30, 2010 12:47 AM >To: Perl Beginners >Subject: Re: regexp matching nummeric ranges >As Rob said [2..254] is a character class that matches one character (so >"127.

Re: regexp matching nummeric ranges

2010-11-29 Thread Guruprasad Kulkarni
Hi Marco, Here is another way to do it: #!/usr/bin/perl use strict; use warnings; my $ip = "127.0.0.1"; if ($ip =~ /^127\.0\.0\.([\d]|[1-9][\d]|[1][\d][\d]|[2]([0-4][\d]|[5][0-4]))$/) { print "IP Matched!\n";; } else { print "No Match!\n"; } On Tue, Nov 30, 2010 at 11:21 AM, Rob Dixon wrote:

Re: regexp matching nummeric ranges

2010-11-29 Thread Rob Dixon
On 29/11/2010 23:46, John W. Krahn wrote: Kammen van, Marco, Springer SBM NL wrote: Dear List, Hello, I've been struggeling with the following: #!/usr/bin/perl use strict; use warnings; my $ip = ("127.0.0.255"); if ($ip =~ /127\.0\.0\.[2..254]/) { print "IP Matched!\n";; } else { print "

Re: regexp matching nummeric ranges

2010-11-29 Thread John W. Krahn
Kammen van, Marco, Springer SBM NL wrote: Dear List, Hello, I've been struggeling with the following: #!/usr/bin/perl use strict; use warnings; my $ip = ("127.0.0.255"); if ($ip =~ /127\.0\.0\.[2..254]/) { print "IP Matched!\n";; } else { print "No Match!\n"; } For a reason i don't

Re: regexp matching nummeric ranges

2010-11-29 Thread Rob Dixon
On 29/11/2010 14:22, Kammen van, Marco, Springer SBM NL wrote: Dear List, I've been struggeling with the following: #!/usr/bin/perl use strict; use warnings; my $ip = ("127.0.0.255"); if ($ip =~ /127\.0\.0\.[2..254]/) { print "IP Matched!\n";; } else { print "No Match!\n"; } For a rea

regexp matching nummeric ranges

2010-11-29 Thread Kammen van, Marco, Springer SBM NL
Dear List, I've been struggeling with the following: #!/usr/bin/perl use strict; use warnings; my $ip = ("127.0.0.255"); if ($ip =~ /127\.0\.0\.[2..254]/) { print "IP Matched!\n";; } else { print "No Match!\n"; } For a reason i don't understand: 127.0.0.1 doesn't match as expected... Eve