Re: Regex question.

2003-07-24 Thread Dennis Stout
> my $date =~ s#(\d{2})(\d{2})(\d{4})#$1/$2/$3#; That amazingly, doesn't have much performance loss to it. I just did: sub build_list_news { my $newstext = ""; my %news = get_news(); foreach (keys %news) { $news{$_}{ctime} =~ s#(\d{4})(\d{2})(\d{2})(\d{2})

RE: Regex question.

2003-07-02 Thread Scot Robnett
(/(\d{2})(\d{2})(\d{4})/); -Original Message- From: Scot Robnett [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 02, 2003 2:03 PM To: Paul Kraus; Sara; [EMAIL PROTECTED] Subject: RE: Regex question. > > 2- Want to format dates like birth = 02151956 should be 02/15/1956 > m

RE: Regex question.

2003-07-02 Thread Scot Robnett
> > 2- Want to format dates like birth = 02151956 should be 02/15/1956 > my $date = "$1/$2/$3/" if (/(\d\d)(\d\d)(\d\d\d\d)/) # All of this is UNTESTED, please treat as such. # More of "the same but different" my $date = qq($1/$2/$3) if /(\d{2})(\d{2})(\d{4})/; # Takes into account dates lik

Re: Regex question.

2003-07-02 Thread Paul Kraus
> 1- Remove all the leading 000 from any field like acct# = 00037839842 > should be 37939842 and Post# should be 1980 s/^0+//; > > 2- Want to format dates like birth = 02151956 should be 02/15/1956 my $date = "$1/$2/$3/" if (/(\d\d)(\d\d)(\d\d\d\d)/) HTH Paul Kraus -- To unsubscribe, e-mail

Re: Regex question.

2003-07-01 Thread Jon Hogue
1- my $number =~ s/^0*(\d+)/$1/ that should trim the leading 0's 2- my $date =~ s#(\d{2})(\d{2})(\d{4})#$1/$2/$3#; i use #'s as delimaters here... some other character may be more appropriate At 07:49 AM 6/26/2003 -0700, Sara wrote: I have a database with the following fields. lname fnam M acct

Re: Regex question

2002-03-11 Thread Randal L. Schwartz
> "Scot" == Scot Robnett <[EMAIL PROTECTED]> writes: Scot> Hey y'all, I got over my brain cramp and thought I'd share with the group in Scot> case it helps anyone trying to do something similar. I was making it way too Scot> complicated. All I needed was: Scot> if($email !~ /\w+@\w+\.\w{2,4}

Re: Regex question

2002-03-11 Thread fliptop
Scot Robnett wrote: > I don't think you can check for the existence of an e-mail address without > actually attempting to send mail to it. You can ping or traceroute a domain, > but only the mail server associated with it knows if the username is valid > or not. If this is wrong, somebody with in

RE: Regex question

2002-03-10 Thread Scot Robnett
I don't think you can check for the existence of an e-mail address without actually attempting to send mail to it. You can ping or traceroute a domain, but only the mail server associated with it knows if the username is valid or not. If this is wrong, somebody with information please reply to the

Re: Regex question

2002-03-10 Thread Rene Verharen
At 10-3-2002 09:36 -0500, fliptop wrote: >>Hey y'all, I got over my brain cramp and thought I'd share with the group in >>case it helps anyone trying to do something similar. I was making it way too >>complicated. All I needed was: >>if($email !~ /\w+@\w+\.\w{2,4}/) >>{ >> # error stuff here >>}

Re: Regex question

2002-03-10 Thread fliptop
Scot Robnett wrote: > Hey y'all, I got over my brain cramp and thought I'd share with the group in > case it helps anyone trying to do something similar. I was making it way too > complicated. All I needed was: > > if($email !~ /\w+@\w+\.\w{2,4}/) > { > # error stuff here > } have you conside

Re: Regex question

2002-03-09 Thread Michael Kelly
On 3/9/02 1:46 PM, Scot Robnett <[EMAIL PROTECTED]> wrote: Hi Scot, > I'm trying to do a simple verification of an e-mail address format. I want > to require: > > - 1 or more alphanumeric characters > - followed by "@" > - followed by 1 or more alphanumerics > - followed by a dot > - followed b

RE: Regex question

2002-03-09 Thread Scot Robnett
Hey y'all, I got over my brain cramp and thought I'd share with the group in case it helps anyone trying to do something similar. I was making it way too complicated. All I needed was: if($email !~ /\w+@\w+\.\w{2,4}/) { # error stuff here } - Scot Robnett inSite Internet Solutions [EMAIL P

Re: regex question

2001-06-16 Thread Ãèªá¤ô¤ë
How you get the data? From a CGI-FORM? or STDIN? Suppose you get the data from a string format... I will do in this way.. $value_list =~ s/,/COMMA/eg; @data = split(/,/, $value_list); ... expressions. ... expressions. ... expressions. ($d0_value0, d0_$value1, $d0_value2) = split(/CO

Re: regex question

2001-06-16 Thread Hasanuddin Tamir
On Fri, 15 Jun 2001, Robert Watterson <[EMAIL PROTECTED]> wrote, > Hi all, > > I have a line that has each field separated by commas. However, some of > individual fields are double quoted strings and also have embedded commas in > them. for example: > > Value1,"Value2, blah,blah,blah",Value3,"V

Re: regex question

2001-06-15 Thread Timothy Kimball
Robert Watterson wrote: : I have a line that has each field separated by commas. However, some of : individual fields are double quoted strings and also have embedded commas in : them. The Text::CSV_XS module will handle this. -- tdk

RE: Regex question

2001-06-11 Thread Evgeny Goldin (aka Genie)
> Or better, how do I learn to use regex? You have to read "Mastering Regular Expressions" if you wanna be an expert, but you don't have to if all you want is to start studying regexes. There are much simpler ways : 1) "Learning Perl" has a chapter about regular expressions 2) perldoc perlre A

Re: Regex question

2001-06-11 Thread Curtis Poe
--- Bruno Veldeman <[EMAIL PROTECTED]> wrote: > I have a string with this format "/blabla/dir/nextdir/name.txt" > I want only 'name.txt' in one string and the rest in another string. my $string = '/blabla/dir/nextdir/name.txt'; my ( $path, $file ) = ( $string=~ m!^(.*/)(.*)$! ); Breaking dow

Re: Regex question

2001-06-11 Thread Roger C Haslock
Perhaps something like my $string = '/blabla/dir/nextdir/name.txt'; $string =~ /(.+)([^\/]*)$/; my $everythinguptoandincludingthelastslash = $1; my $everythingbeyondthelastslashtotheendoftheline = $2; # [^\/] == notaslash (escaped by a backslash) # [...]* == zero or more of them # $/ == endoflin

RE: Regex question

2001-06-09 Thread Moon, John
Hope this helps ... >perl -e '$str="/blabla/dir/nextdir/name.txt"; ($path,$filenm)=$str=~m/(^.+)\/(\w+\.\w+$)/; print "path=<$path>,file name=<$filenm>\n";' path=,file name= John W Moon -Original Message- From: Bruno Veldeman [mailto:[EMAIL PROTECTED]] Sent: June 09, 2001 16:08 To: [EMA

Re: Regex question

2001-06-09 Thread fliptop
Bruno Veldeman wrote: > > I have a string with this format "/blabla/dir/nextdir/name.txt" > I want only 'name.txt' in one string and the rest in another string. in this case, i would use split: $location = "/blabla/dir/nextdir/name.txt"; @dirs = split("\/", $location); foreach (@dirs) { print