>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
+
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+)$/;
> >
Hi Joel,
Ok... it is working just as i want...
No problem if the number is 1.8.6.5.4.3
Thanks,
Wagner Garcia Campagner
-Mensagem original-
De: Joel Hughes [mailto:[EMAIL PROTECTED]]
Enviada em: terça-feira, 10 de dezembro de 2002 12:21
Para: 'perl cgi'
Assunto: RE: Regular
-
From: Wagner [mailto:[EMAIL PROTECTED]]
Sent: 10 December 2002 16:03
To: 'perl cgi'
Subject: Regular Expression
Hello,
I have this regular expression:
$List =~ /^(?:(\d+)\*)?(\w+)\/(?:(\d+)\*)?(\w+)$/;
It checks for a string like this: number*word/number*word
But it only accept int
Hello,
I have this regular expression:
$List =~ /^(?:(\d+)\*)?(\w+)\/(?:(\d+)\*)?(\w+)$/;
It checks for a string like this: number*word/number*word
But it only accept integer number...
Does anybody knows how to change it to accept decimal numbers like 0.1???
Thanks,
Wagner Garcia Campagner
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.
>
>
Hi all,
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.
I've seen that \b doesn't match the end or beginning of a string.
I
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
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
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
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
Hi,
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 be a string that exist in an
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
>>
>
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,
>
Hi all,
would like to consult the perl gurus on the below:-
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, appli
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
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
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;
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 overhead to apply a regular expression to
each line rather than using the built-in split func
...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
> 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 '
;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
D]>
Sent: Friday, May 17, 2002 9:52 AM
Subject: RE: regular expression
> Regular expressions are overkill for what you're trying to do. It seems like
> using 'split' should do exactly what you need.
>
> #!/usr/bin/perl -W
>
> use strict;
> open(IN," my @l
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,
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
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
>
> 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
n";
}
exit;
shawn
- Original Message -
From: "ChaoZ InferNo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 17, 2002 4:01 AM
Subject: regular expression
> hi all,
>
> i am working to split the data in my array as follows but en
hi all,
i am working to split the data in my array as follows but ended up clueless,
hoope some of u can help.
@text # contains values of a phone directory
$text[0] contains john=012345678
$phone1 = ?
let say i wanted to grab just the values'012345678'.
how should i go on truncating the value
Has anyone ever turned the mysql timestamp format 20020303223726 into something more
readable like - 03/03/2002 22:37:26? I am also trying to do this from an array (the
timestamp is in a array). I just figured somebody has probably done this already.
Thanks, Rob
---
hi
i have just started using perl and i am getting to grips quite quickly
although i would like to know : i have a text file and i need a regular
expression to pull he information off that file...?
Help would be much appreciated!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
Hi All,
I am writing a program to display POD, functions, Perl FAQ, and programs and
want to impement two rules for the input:
1. it is Perl module names if the input starts with words or '-m';
2. it is Perl function, FAQ, or program name if it starts with -f, -q, or -p
respectively.
Here is th
32 matches
Mail list logo