To: beginners@perl.org
Subject: Re: Simple regex question
You wrote on 05/19/2009 03:18 PM:
Simple question for the regEXperts out there...
I have a string that is always in the format: a.nn+x.y
a is always 5 chars
n can be 1 or 2 digits
x can be +/- (with sign), 1-4 digits
y is always positive
You wrote on 05/19/2009 03:18 PM:
Simple question for the regEXperts out there...
I have a string that is always in the format: a.nn+x.y
a is always 5 chars
n can be 1 or 2 digits
x can be +/- (with sign), 1-4 digits
y is always positive (no sign), 1-4 digits
The best I can come
On Tue, May 19, 2009 at 09:18, Dan Fish d...@ninemoons.com wrote:
Simple question for the regEXperts out there...
I have a string that is always in the format: a.nn+x.y
a is always 5 chars
n can be 1 or 2 digits
x can be +/- (with sign), 1-4 digits
y is always positive (no sign), 1-4
On Tue, May 19, 2009 at 09:55, Alexander Koenig alexander.koe...@mpi.nl wrote:
snip
($a,$n,$x,$y)) = $item =~ /(.{5})\.(\d\d?)[-+](\d{1,4})\.(\d{1,4})/;
snip
As of Perl 5.8 \d no longer matches [0-9]. It now matches any UNICODE
character that has the digit property. This includes characters
A crude one
($part,$unit,$x,$y,$xlen,$ylen) = ($1,$2,$3,length($4),length($5))
if ($string =~ /(^\S{5})\.(\d{2})([+-])(\d+)\.(\d+)$/);
-Original Message-
From: Dan Fish [mailto:d...@ninemoons.com]
Sent: 19 May 2009 14:18
To: beginners@perl.org
Subject: Simple regex question
Simple
Simple question for the regEXperts out there...
I have a string that is always in the format: a.nn+x.y
a is always 5 chars
n can be 1 or 2 digits
x can be +/- (with sign), 1-4 digits
y is always positive (no sign), 1-4 digits
snip
What do you mean by chars? Is any
Chas. Owens wrote on 05/19/2009 04:02 PM:
($a,$n,$x,$y)) = $item =~ /(.{5})\.(\d\d?)[-+](\d{1,4})\.(\d{1,4})/;
snip
As of Perl 5.8 \d no longer matches [0-9]. It now matches any UNICODE
character that has the digit property. This includes characters such
as \x{1815} (MONGOLIAN DIGIT
On Tue, May 19, 2009 at 10:21, Alexander Koenig alexander.koe...@mpi.nl wrote:
Chas. Owens wrote on 05/19/2009 04:02 PM:
($a,$n,$x,$y)) = $item =~ /(.{5})\.(\d\d?)[-+](\d{1,4})\.(\d{1,4})/;
snip
As of Perl 5.8 \d no longer matches [0-9]. It now matches any UNICODE
character that has the
Dan Fish wrote:
Simple question for the regEXperts out there...
I have a string that is always in the format: a.nn+x.y
a is always 5 chars
[a-zA-Z0-9]{5}
n can be 1 or 2 digits
[0-9]{1,2}
x can be +/- (with sign), 1-4 digits
[-+][0-9]{1,4}
y is always positive (no sign),
Chas. Owens wrote:
On Tue, May 19, 2009 at 09:55, Alexander Koenig alexander.koe...@mpi.nl wrote:
snip
($a,$n,$x,$y)) = $item =~ /(.{5})\.(\d\d?)[-+](\d{1,4})\.(\d{1,4})/;
snip
As of Perl 5.8 \d no longer matches [0-9].
^
As of Perl 5.8 \d no longer
Dan Fish wrote:
Simple question for the regEXperts out there...
I have a string that is always in the format: a.nn+x.y
a is always 5 chars
[a-zA-Z0-9]{5}
n can be 1 or 2 digits
[0-9]{1,2}
x can be +/- (with sign), 1-4 digits
[-+][0-9]{1,4}
y is always positive (no sign),
see below
/^[^0-9a-fA-F]+$/ #if this evals to true string is NOT
## start of string ^ and end of string $
-Original Message-
From: RTO RTO [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 11:00 AM
To: [EMAIL PROTECTED]
Subject: Simple RegEx Question
Here is a RegEx
I am afraid, your suggestion is even breaking for
already working ones! i.e., it says HEXADECIMAL NUMBER
for an invalid string like f4dx and also says
HEXADECIMAL NUMBER for invalid empty strings.
The one I had posited,without the leading ^ and $
matched for all the cases correctly, except for
give us a snippet of your code. you made a mistake somewhere.
and give us examples of what the variables contain.
-Original Message-
From: RTO RTO [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 11:09 AM
To: Nikola Janceski; [EMAIL PROTECTED]
Subject: RE: Simple RegEx
-Original Message-
From: RTO RTO [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 11:00 AM
To: [EMAIL PROTECTED]
Subject: Simple RegEx Question
Here is a RegEx that I am using to check if the given
string is Hexadecimal or not.
/[^0-9a-fA-F]+/ #if this evals
use strict;
while(DATA){
chomp;
if(/[^0-9a-fA-F]+/){
print($_ is not a hexadecimal number!\n);
}else{
print($_ is a hexadecimal number!\n);
}
}
__DATA__
f4dxf
ffaa99
gxad
2832
2842da
--- Nikola Janceski [EMAIL PROTECTED]
wrote:
give us a snippet of your code. you made a
PROTECTED]
Subject: RE: Simple RegEx Question
use strict;
while(DATA){
chomp;
if(/[^0-9a-fA-F]+/){
print($_ is not a hexadecimal number!\n);
}else{
print($_ is a hexadecimal number!\n);
}
}
__DATA__
f4dxf
ffaa99
gxad
2832
2842da
--- Nikola Janceski [EMAIL PROTECTED]
wrote:
give us
Thanks Nikola and Bob.
Would anchoring with \z tantamount to having a
trailing $? In other words, are the following
expressions one and the same?
/^[0-9a-fA-F]+\z/
/^[0-9a-fA-F]+$/
__
Yahoo! - We Remember
9-11: A tribute to the more than
PROTECTED]
Subject: RE: Simple RegEx Question
Thanks Nikola and Bob.
Would anchoring with \z tantamount to having a
trailing $? In other words, are the following
expressions one and the same?
/^[0-9a-fA-F]+\z/
/^[0-9a-fA-F]+$/
__
Yahoo! - We
i don't understand your answer. how will that match anything?
the first line matches the whole block ok, but then the match is dropped
by the '!' phrases
since they are in the text.
also, where is documented the ellipsis in a grep?
also, using two regexes on either side of the ellipsis?
On
sorry. still in dark.
what exactly does '/START_KEYWORD/.../END_KEYWORD/' mean?
I see a regex - /START_KEYWORD/
an ellipsis - ...
and a regex - /END_KEYWORD/
you are saying the whole thing means something, but I don't understand
what.
you say 'the elipsis returns false'
what does that mean?
From: bob ackerman [EMAIL PROTECTED]
sorry. still in dark.
what exactly does '/START_KEYWORD/.../END_KEYWORD/' mean?
I see a regex - /START_KEYWORD/
an ellipsis - ...
and a regex - /END_KEYWORD/
you are saying the whole thing means something, but I don't understand
what.
Ah... i see.
in scalar context, it returns false until left is true. then returns true
until right is true.
just what we want. very handy.
thanks.
On Saturday, March 30, 2002, at 11:48 AM, Jenda Krynicky wrote:
From: bob ackerman [EMAIL PROTECTED]
sorry. still in dark.
what
--- Mike Ring [EMAIL PROTECTED] wrote:
I've learned a bit about regular expressions today. I have a string
formatted
like CN=foo,OU=bar,O=pah and I need to parse out foo. I have
created the
following code which does work:
$dnvalue =~ m/([^,]*)/;
$username = $1;
$username =~ s/(CN=)//;
There's no need to match past the CN=, then prepend the CN= back to the
string. Use the following
$dnvalue = CN=foo,OU=bar,O=pah;
$dnvalue =~ /(CN=[A-Za-z0-9]*)/;
$username = $1;
print $username
This looks for CN= followed by any number of letters (upper or lowercase)
and numbers. If you don't
Sorry. Ignore that. It's 5:30 and home time. What can I say.
Use this instead.
$dnvalue =~ /CN=(\w*)/;
$username = $1;
print $username
-Original Message-
From: John Edwards [mailto:[EMAIL PROTECTED]]
Sent: 28 June 2001 17:31
To: 'Mike Ring'; [EMAIL PROTECTED]
Subject: RE: simple regex
26 matches
Mail list logo