RE: Simple regex question

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

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 can come

Re: Simple regex question

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

Re: Simple regex question

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

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 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 chars? Is any

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 DIGIT

Re: Simple regex question

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

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),

Re: Simple regex question

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

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),

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

RE: Simple RegEx Question

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

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 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. /[^0-9a-fA-F]+/ #if this evals

RE: Simple RegEx Question

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

RE: Simple RegEx Question

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

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

RE: Simple RegEx Question

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

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

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?

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 understand what.

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. what

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 =~ s/(CN=)//;

RE: simple regex question

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

RE: simple regex question

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