RE: Simple regex question

2009-05-19 Thread Ajay Kumar
: 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

Re: Simple regex question

2009-05-19 Thread John W. Krahn
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

Re: Simple regex question

2009-05-19 Thread John W. Krahn
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].

Re: Simple regex question

2009-05-19 Thread John W. Krahn
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

Re: Simple regex question

2009-05-19 Thread Chas. Owens
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

Re: Simple regex question

2009-05-19 Thread Alexander Koenig
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

RE: Simple regex question

2009-05-19 Thread Dan Fish
> > 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

RE: Simple regex question

2009-05-19 Thread Andrew Curry
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

Re: Simple regex question

2009-05-19 Thread Chas. Owens
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

Re: Simple regex question

2009-05-19 Thread Chas. Owens
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

Re: Simple regex question

2009-05-19 Thread Alexander Koenig
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 regex question

2009-05-19 Thread Dan Fish
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

RE: Simple RegEx Question

2002-09-11 Thread Timothy Johnson
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]+$/ _

RE: Simple RegEx Question

2002-09-11 Thread RTO RTO
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

RE: Simple RegEx Question

2002-09-11 Thread Nikola Janceski
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

RE: Simple RegEx Question

2002-09-11 Thread RTO RTO
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

RE: Simple RegEx Question

2002-09-11 Thread Bob Showalter
> -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.

RE: Simple RegEx Question

2002-09-11 Thread Nikola Janceski
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

RE: Simple RegEx Question

2002-09-11 Thread RTO RTO
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

RE: Simple RegEx Question

2002-09-11 Thread Nikola Janceski
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

Simple RegEx Question

2002-09-11 Thread RTO RTO
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

Re: Simple regex question

2002-03-30 Thread bob ackerman
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. >

Re: Simple regex question

2002-03-30 Thread Jenda Krynicky
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

Re: Simple regex question

2002-03-30 Thread bob ackerman
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

Re: Simple regex question

2002-03-30 Thread Jenda Krynicky
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?

Re: Simple regex question

2002-03-30 Thread bob ackerman
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

Re: Simple regex question

2002-03-30 Thread Jenda Krynicky
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

Simple regex question

2002-03-30 Thread Rob Lee
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

RE: simple regex question

2001-06-28 Thread John Edwards
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

RE: simple regex question

2001-06-28 Thread John Edwards
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&#x

Re: simple regex question

2001-06-28 Thread Paul
--- 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

simple regex question

2001-06-28 Thread Mike Ring
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