: 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
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), 1
Chas. Owens wrote:
On Tue, May 19, 2009 at 09:55, Alexander Koenig 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 matches only [0-9].
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), 1
On Tue, May 19, 2009 at 10:21, Alexander Koenig 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 digit propert
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 DI
> > 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 char
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
On Tue, May 19, 2009 at 09:55, Alexander Koenig 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 such
as "\x{1815}" (MONGO
On Tue, May 19, 2009 at 09:18, 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
> 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
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 ca
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
Some examples:
A123C.11+002.001
FC32G.2-1.0
11, 2002 8:26 AM
To: Bob Showalter; [EMAIL 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]+$/
_
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 3
ola Janceski; [EMAIL PROTECTED]
Subject: RE: Simple RegEx Question
use strict;
while(){
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
--- N
use strict;
while(){
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 mist
> -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.
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
iginal 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
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
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 to true string is NOT
hex
I am having a trailing "+" to make sure at least one
permissible character is present. Yet, it matches an
empty string as a hex string.
a) What am I mis
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.
>
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 underst
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? w
From: bob ackerman <[EMAIL PROTECTED]>
> 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?
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 Satu
From: Rob Lee <[EMAIL PROTECTED]>
> I'm parsing a file with multiple Fortran-like blocks that look like:
> START_KEYWORD
> line 1
> line 2
> END_KEYWORD
>
> I want only the contents of each block, not the keywords.
>
> grep { /START_KEYWORD/.../END_KEYWORD/ }
> returns
I'm parsing a file with multiple Fortran-like blocks that look like:
START_KEYWORD
line 1
line 2
END_KEYWORD
I want only the contents of each block, not the keywords.
grep { /START_KEYWORD/.../END_KEYWORD/ }
returns the entire block - including t
or lowercase)
and numbers. If you don't mind matching on an underscore too (_) use the
following instead
$dnvalue =~ /(CN=\w*)/;
HTH
John
-Original Message-
From: Mike Ring [mailto:[EMAIL PROTECTED]]
Sent: 28 June 2001 17:17
To: [EMAIL PROTECTED]
Subject: simple regex questio
numbers. If you don't mind matching on an underscore too (_) use the
following instead
$dnvalue =~ /(CN=\w*)/;
HTH
John
-Original Message-
From: Mike Ring [mailto:[EMAIL PROTECTED]]
Sent: 28 June 2001 17:17
To: [EMAIL PROTECTED]
Subject: simple regex question
Hello all.
I
--- 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
Hello all.
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=)//;
print $username
However, I'd lik
32 matches
Mail list logo