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
At some point I really do need to read that damn regex book...pass the advil please. http://danconia.org On Wed, 23 Jul 2003 17:51:09 -0400, "Hall, Scott" <[EMAIL PROTECTED]> wrote: > Sara, > > You can use "ucfirst". > > $TS =~ s/(\w+)/ucfirst l

RE: Another Regex question.

2003-07-23 Thread Scot Robnett
Or you could do what Scott Hall said! :-) Didn't know about that one...talk about making life easier. - Scot Robnett inSite Internet Solutions [EMAIL PROTECTED] -Original Message- From: Sara [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 11:59 AM To: org Subject: Another

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
#!/usr/bin/perl -w my $TS = "THIS INPUT IS IN ALL CAPS"; my $lc_ts = lc($TS); my @words = split(/\s+/, $lc_ts); my @letters = (); foreach my $word(@words) { chomp($word); if($word =~ /^(\w{1})(\w*)/) { print uc($1) . $2 . " "; } else { die "Something is seriously wrong here..."; } }

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; $TS now prints out "this

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