Re: Changing case of the first letter of words in string

2003-08-26 Thread zsdc
bis wrote: #!/usr/bin/perl -p s/(\s)(.)/$1\u$2/g if/SCTN:/; This capitalises the first letter of every word in the whole document. No, it doesn't. Only the lines containing "SCTN:" Have you run it? yes i have run it and below is the kind of output i get (original input all lower case except cap

Re: Changing case of the first letter of words in string

2003-08-26 Thread bis
--- zsdc <[EMAIL PROTECTED]> wrote: > *Please* CC the mailing list when you answer. I'm > writing it so everyone > on the list could learn something, not just to fix > your program or solve > your particular problem. > thanks for the reminder zsdc - i should have remembered to cc the list when

Re: Changing case of the first letter of words in string

2003-08-23 Thread zsdc
*Please* CC the mailing list when you answer. I'm writing it so everyone on the list could learn something, not just to fix your program or solve your particular problem. bis wrote: Tnaks zsdc and JEGII. --- zsdc <[EMAIL PROTECTED]> wrote: It gives a syntax error. Maybe try this: #!/usr/b

Re: Changing case of the first letter of words in string

2003-08-23 Thread James Edward Gray II
On Saturday, August 23, 2003, at 02:34 AM, zsdc wrote: s/(SCTN:\s*)(.+)$/join '', $1, map { ucfirst $_ } split /( )/, $2/ge; See if that helps any. It gives a syntax error. Maybe try this: Sorry, I forgot to backwack those /. My fault for not testing the code. I'll try again: s{(SCTN:\s*)(.+)

Re: Changing case of the first letter of words in string

2003-08-23 Thread zsdc
James Edward Gray II wrote: On Friday, August 22, 2003, at 05:06 PM, bis wrote: Thanks Gabriel - your suggested code s/(SCTN:\s*)(\w+)/$1\u$2\E/g; [...] Well, let's see if we can get a little closer: s/(SCTN:\s*)(.+)$/join '', $1, map { ucfirst $_ } split /( )/, $2/ge; See if that helps any.

Re: Changing case of the first letter of words in string

2003-08-22 Thread James Edward Gray II
On Friday, August 22, 2003, at 05:06 PM, bis wrote: Thanks Gabriel - your suggested code s/(SCTN:\s*)(\w+)/$1\u$2\E/g; is an improvement - it does capitalise the first letter - but only of the first word after "SCTN: " so i get something like SCTN: This is a section name What I need is SCTN:

Re: Changing case of the first letter of words in string

2003-08-22 Thread bis
Thanks Gabriel - your suggested code s/(SCTN:\s*)(\w+)/$1\u$2\E/g; is an improvement - it does capitalise the first letter - but only of the first word after "SCTN: " so i get something like SCTN: This is a section name What I need is SCTN: This Is A Section Name hope that makes sense! :)

Re: Changing case of the first letter of words in string

2003-08-22 Thread John W. Krahn
Bis wrote: > > I want to make the case of the first letter of all the words in a > selected string to upper case. The code > > s/\b(\w+)/\u$1\E/g; > > enables me to do this for the whole document. > > But the string I want to match and operate on is all instances of > text following the string

Re: Changing case of the first letter of words in string

2003-08-22 Thread David K. Wall
Bis <[EMAIL PROTECTED]> wrote: I want to make the case of the first letter of all the words in a selected string to upper case. The code s/\b(\w+)/\u$1\E/g; enables me to do this for the whole document. But the string I want to match and operate on is all instances of text following the string SC

Re: Changing case of the first letter of words in string

2003-08-22 Thread Gabriel Cooper
Bis wrote: I want to make the case of the first letter of all the words in a selected string to upper case. The code s/\b(\w+)/\u$1\E/g; enables me to do this for the whole document. But the string I want to match and operate on is all instances of text following the string SCTN: as in SCTN: N