RE: Regular Expression

2002-12-10 Thread Larry Coffin
>This should do the trick... >$List =~ /^(?:([\d|\.]+)\*)?(\w+)\/(?:([\d|\.]+)\*)?(\w+)$/; Note that this will also pass '12|34.56' as a valid number because of the '|' in the '[...]'. I think you will really want just '[\d\.]'. ---Larry +

Re: Regular Expression

2002-12-10 Thread Keex
hi there - I did not try this, but it seems somewhat logical to me: $List =~ /^(?:(\d+(\.\d+)?)\*)?(\w+)\/(?:(\d+(\.\d+)?)\*)?(\w+)$/; > > Hello, > > > > I have this regular expression: > > > > $List =~ /^(?:(\d+)\*)?(\w+)\/(?:(\d+)\*)?(\w+)$/; > > > > It checks for a string like this: number

RE: Regular Expression

2002-12-10 Thread Joel Hughes
Hi Wagner, This should do the trick... $List =~ /^(?:([\d|\.]+)\*)?(\w+)\/(?:([\d|\.]+)\*)?(\w+)$/; Basically looks like you need a character class to accept a '.' as well. (However, this reg exp looks like it will let thru 100.0.0.1 is a number!) Joel -Original Message- From: Wagn

Re: Regular expression

2002-09-08 Thread Janek Schleicher
Octavian Rasnita wrote at Sat, 07 Sep 2002 11:03:39 +0200: > I am trying to match a word boundry or an end of string. > I would like something like: > > /$word[\bX]/ > > where X is the symbol used for end of string. I know that I can use $ but I > don't think I can use it between brackets. > >

Re: regular expression

2002-07-28 Thread Janek Schleicher
Gsulinux wrote at Sat, 27 Jul 2002 13:32:27 +0200: > I wanna check the information typed in the form field whether if it is in date >format or not . > Like : check it if it is in format day/mount/year , in format like ab/cd/ef or >ab/cd/efgh "ab" > must be valid like between 1-31 > "cd" must be

Re: regular expression

2002-07-27 Thread drieux
On Saturday, July 27, 2002, at 05:31 , fliptop wrote: > GsuLinuX wrote: > > > > I wanna check the information typed in the form field whether if it > > is in date format or not . [..] > you should look into using Date::Calc. it has many functions for > checking a date's validity, extracting pa

Re: regular expression

2002-07-27 Thread Wiggins d'Anconia
On a side note, where you said "A[12]" just to avoid future problems either you wanted A[11] or don't forget to add a blank starting element in the array, as arrays are indexed starting at 0!! http://danconia.org fliptop wrote: > GsuLinuX wrote: > > > > I wanna check the information typed i

Re: regular expression

2002-07-27 Thread fliptop
GsuLinuX wrote: > > I wanna check the information typed in the form field whether if it > is in date format or not . Like : check it if it is in format > day/mount/year , in format like ab/cd/ef or ab/cd/efgh "ab" must > be valid like between 1-31 "cd" must be valid between 1-12 or must > b

Re: Regular expression again 8P

2002-05-20 Thread drieux
On Monday, May 20, 2002, at 03:43 , Shawn wrote: > To get just the Auth... > > (my $var2=$var)=~s/^.*Proxy-Authorization: Basic //ms; > $var2=~s/\n.*$//ms; > > This is unetested... actually i just tested it - works well. > Shawn > >> my $var = m/Proxy-Authorization:.+/; #should return true >> >

Re: Regular expression again 8P

2002-05-20 Thread Shawn
Hey ChaoZ, > my $var=" > GET http://us.a1.yimg.com/us.yimg.com/i/mntl/lnch/britney.jpg HTTP/1.0 > Host: us.a1.yimg.com > User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4) Gecko/20011126 > Netscape6/6.2.1 > Accept: text/xml, application/xml, application/xhtml+xml, text/html;q=0.9, >

Re: regular expression vs split

2002-05-19 Thread drieux
On Sunday, May 19, 2002, at 02:30 , Ross Esposito wrote: > I "think" split is compiled only once while regex (as used in the previous > posts) is compiled everytime a new line is to be matched. (you can use qr/ > /) > > Someone fire up Benchmark. I could be wrong :) > > xgunnerx funny you shoul

RE: regular expression vs split

2002-05-19 Thread Ross Esposito
nt: Friday, May 17, 2002 10:31 AM To: Brian; [EMAIL PROTECTED] Subject: RE: regular expression vs split I don't believe that a regex would be faster in an instance like this, but someone please correct me if I'm wrong. It seems that it would add (albeit a very minimal amount) processing

Re: regular expression

2002-05-17 Thread John Brooking
I just happened to write exactly this the other day, as a generic configuration file reader. Here's the basics: sub readINI {# argument: filename my %params; open( INIFILE, $_[0] ) || die "Could not open $_[0]\n"; while() { if(! /^#/ ) { # Allow comments chomp;

RE: regular expression vs split

2002-05-17 Thread Scot Robnett
t Robnett inSite Internet Solutions [EMAIL PROTECTED] [EMAIL PROTECTED] -Original Message- From: Brian [mailto:[EMAIL PROTECTED]] Sent: Friday, May 17, 2002 10:17 AM To: [EMAIL PROTECTED] Subject: RE: regular expression vs split Curious, but I've always thought that regex was much qui

RE: regular expression

2002-05-17 Thread Joel Hughes
...it certainly looks like a regex to me -Original Message- From: Shawn [mailto:[EMAIL PROTECTED]] Sent: 17 May 2002 16:03 To: Scot Robnett; ChaoZ Inferno; [EMAIL PROTECTED] Subject: Re: regular expression Ok, first, thanks for the correction and input David... I agree 100% with what

Re: regular expression

2002-05-17 Thread Shawn
> Actually, the content of the file looks something like:- > name=john > id=12345 > password=12345 > colour=blue Ok, how about this then... This is based on the fact that name, id, password, colour appear for every record whether they have a value or not, and that none of the values after the '

RE: regular expression vs split

2002-05-17 Thread Brian
;Your $field is $value. \n"; >} > > >Scot Robnett >inSite Internet Solutions >[EMAIL PROTECTED] >[EMAIL PROTECTED] > > >-Original Message- >From: ChaoZ Inferno [mailto:[EMAIL PROTECTED]] >Sent: Friday, May 17, 2002 11:38 AM >To: [EMAIL PROTECTED] >Su

Re: regular expression

2002-05-17 Thread Shawn
OTECTED] > > > -Original Message- > From: ChaoZ Inferno [mailto:[EMAIL PROTECTED]] > Sent: Friday, May 17, 2002 11:38 AM > To: [EMAIL PROTECTED] > Subject: Re: regular expression > > > Actually, the content of the file looks something like:- > name=john &g

RE: regular expression

2002-05-17 Thread Scot Robnett
int "Your $field is $value. \n"; } Scot Robnett inSite Internet Solutions [EMAIL PROTECTED] [EMAIL PROTECTED] -Original Message- From: ChaoZ Inferno [mailto:[EMAIL PROTECTED]] Sent: Friday, May 17, 2002 11:38 AM To: [EMAIL PROTECTED] Subject: Re: regular expression Actually,

Re: regular expression

2002-05-17 Thread ChaoZ Inferno
quot;David Gray" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: "'ChaoZ InferNo'" <[EMAIL PROTECTED]>; "'Shawn'" <[EMAIL PROTECTED]> Sent: Friday, May 17, 2002 10:16 PM Subject: RE: regular expression > > > ... > > f

Re: regular expression

2002-05-17 Thread fliptop
ChaoZ InferNo wrote: > @text # contains values of a phone directory > $text[0] contains john=012345678 > > $phone1 = ? > > let say i wanted to grab just the values'012345678'. if the format of $text[0] is always name=number you can use split instead of a regex. perldoc -f split -- To uns

RE: regular expression

2002-05-17 Thread David Gray
> > for(@text) { > /(d+)$/; # Match only the numbers at the end of the string ^^ this should actually be (\d+) I would actually conditionally print also, like so: print $1 if /(\d+)$/; And depending on the size of the file, instead of reading the whole thing into memory wi

Re: regular expression

2002-05-17 Thread Shawn
Hey Chaoz, #!/usr/bin/perl use strict; open(FILE,'); close(FILE); for(@text) { /(d+)$/; # Match only the numbers at the end of the string # and store them in '$1' to be printed out on the # next line followed by a new line character print $1,"\n"; } exit; shawn -