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: Another Regex question.

2003-07-23 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Sara wrote: > $TS = "THIS INPUT IS IN ALL CAPS"; > > $TS_cont = lc $TS; > > $TS now prints out "this input is in all caps" > > What If I want first letter in caps for every word in string? which should > be "This Input Is In All Caps" > > TIA, > > Sara. perldo

Re: Another Regex question.

2003-07-23 Thread drieux
On Wednesday, Jul 23, 2003, at 09:58 US/Pacific, Sara wrote: $TS = "THIS INPUT IS IN ALL CAPS"; $TS_cont = lc $TS; $TS now prints out "this input is in all caps" What If I want first letter in caps for every word in string? which should be "This Input Is In All Caps" a way of solving this woul

RE: Another Regex question.

2003-07-23 Thread wiggins
". > > $TS =~ s/(\w+)/ucfirst lc $1/ge; > > Scott > > -Original Message- > From: Sara [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 23, 2003 12:59 PM > To: org > Subject: Another Regex question. > > > $TS = "THIS INPUT IS IN ALL CA

RE: Another Regex question.

2003-07-23 Thread Scot Robnett
other Regex question. $TS = "THIS INPUT IS IN ALL CAPS"; $TS_cont = lc $TS; $TS now prints out "this input is in all caps" What If I want first letter in caps for every word in string? which should be "This Input Is In All Caps" TIA, Sara. -- To unsubsc

RE: Another Regex question.

2003-07-23 Thread wiggins
On Wed, 23 Jul 2003 21:58:52 +0500, "Sara" <[EMAIL PROTECTED]> wrote: > $TS = "THIS INPUT IS IN ALL CAPS"; > > $TS_cont = lc $TS; > > $TS now prints out "this input is in all caps" > > What If I want first letter in caps for every word in string

RE: Another Regex question.

2003-07-23 Thread Scot Robnett
ww.mawebcenters.com/insite2000 -Original Message- From: Sara [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 11:59 AM To: org Subject: Another Regex question. $TS = "THIS INPUT IS IN ALL CAPS"; $TS_cont = lc $TS; $TS now prints out "this input is in all caps" Wha

RE: Another Regex question.

2003-07-23 Thread Hall, Scott
Sara, You can use "ucfirst". $TS =~ s/(\w+)/ucfirst lc $1/ge; Scott -Original Message- From: Sara [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 12:59 PM To: org Subject: Another Regex question. $TS = "THIS INPUT IS IN ALL CAPS"; $TS_cont = lc $TS;

Another Regex question.

2003-07-23 Thread Sara
$TS = "THIS INPUT IS IN ALL CAPS"; $TS_cont = lc $TS; $TS now prints out "this input is in all caps" What If I want first letter in caps for every word in string? which should be "This Input Is In All Caps" TIA, Sara.

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

Regex question.

2003-06-30 Thread Sara
I have a database with the following fields. lname fnam M acct# mrmbirth Postdate Post# drln drfn m disch DOE,JOHN,R,00037839842,207337,02151956,04072003,01980,LastName,FirstName,L,04102003 I have a very simple script which splits the delimiter , and sh

RE: Another regex question

2003-05-30 Thread Scot Robnett
Andrew, Thanks for trying to help. Scot -Original Message- From: Andrew Brosnan [mailto:[EMAIL PROTECTED] Sent: Thursday, May 29, 2003 3:05 PM To: Scot Robnett; [EMAIL PROTECTED] Subject: RE: Another regex question Try this: #!/usr/bin/perl #File: use warnings; use strict; #set

RE: Another regex question

2003-05-30 Thread Andrew Brosnan
Try this: #!/usr/bin/perl #File: use warnings; use strict; #set slurp mode undef $/; my $stuff_i_want; while () {#read in your file #match up to Today's Headlines (or whatever) if (/Today's Headlines:<\/strong>/) { $stuff_i_want = $'; #put the rest in $stuff_i_want }

RE: Another regex question

2003-05-30 Thread Scot Robnett
.. -Original Message- From: Andrew Brosnan [mailto:[EMAIL PROTECTED] Sent: Thursday, May 29, 2003 1:45 PM To: Scot Robnett; [EMAIL PROTECTED] Subject: RE: Another regex question On 5/29/03 at 12:27 PM, [EMAIL PROTECTED] (Scot Robnett) wrote: Will the file always be formated as below (wi

RE: Another regex question

2003-05-30 Thread Andrew Brosnan
On 5/29/03 at 12:27 PM, [EMAIL PROTECTED] (Scot Robnett) wrote: Will the file always be formated as below (with the blank line between articles)? If so you could set the record separator '$/' to paragraph mode to read each of them in: # $/; #default is newline # $/ = ""; # paragraph mode

RE: Another regex question

2003-05-30 Thread Scot Robnett
I read perlfaq6. Several times, in fact, and specifically the section you're pointing out. I'm one of those people who needs a good beating to understand something, but once I "get it" I don't forget...just not there yet. I basically want to extract the first several lines of the file, maybe to di

Re: Another regex question

2003-05-30 Thread Andrew Brosnan
On 5/29/03 at 11:22 AM, [EMAIL PROTECTED] (Scot Robnett) wrote: > Okay, > > I've looked at perlre, perlretut, perldoc.com, Learning Perl, and a > partridge in a pear tree, and I'm still stupid. :) > > Does anyone out there have a working example script that does > matching over multiple lines, p

Another regex question

2003-05-30 Thread Scot Robnett
Okay, I've looked at perlre, perlretut, perldoc.com, Learning Perl, and a partridge in a pear tree, and I'm still stupid. :) Does anyone out there have a working example script that does matching over multiple lines, preferably an HTML file? I'm just having a lot of difficulty with this and it wo

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
ons [EMAIL PROTECTED] http://www.insiteful.tv -Original Message- From: Scot Robnett [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 09, 2002 3:47 PM To: [EMAIL PROTECTED] Subject: Regex question I'm trying to do a simple verification of an e-mail address format. I want to require:

Regex question

2002-03-09 Thread Scot Robnett
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 by 2-4 alphanumerics. (for example, .

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

regex question

2001-06-15 Thread Robert Watterson
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,"Value4,blah",Value5 When I use the split function using the split pattern of /

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
re of them # $/ == endofline - Roger - - Original Message - From: "Bruno Veldeman" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, June 09, 2001 9:07 PM Subject: Regex question > Hi, > > I can't seem to get the regex right for this: > > I

RE: Regex question

2001-06-09 Thread Moon, John
MAIL PROTECTED]] Sent: June 09, 2001 16:08 To: [EMAIL PROTECTED] Subject: Regex question Hi, I can't seem to get the regex right for this: 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.

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

Regex question

2001-06-09 Thread Bruno Veldeman
Hi, I can't seem to get the regex right for this: 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. It would be nice explaining the regex in plain english. Or better, how do I learn to use regex? For now i