Re: Regular expression to capitalize first letter of words in sentence

2011-04-14 Thread marcos rebelo
I agree completely with you, clean code is the best documentation. But in your snippet I have to say: The use of $& anywhere in a program imposes a considerable performance penalty on all regular expression matches. it would be better to avoid default/magic variables. I would consider this snippe

Re: Regular expression to capitalize first letter of words in sentence

2011-04-14 Thread John Delacour
At 13:39 +0300 12/04/2011, Shlomit Afgin wrote: I need to write regular expression that will capitalize the first letter of each word in the string. Word should be word that her length is greater or equal to 3 letters exclude the words 'and' and 'the'. I tried: $string = lc($string); $string

Re: Regular expression to capitalize first letter of words in sentence

2011-04-13 Thread Rob Dixon
e. A common rule, and the one I prefer, is to capitalise all words except articles, conjunctions, and prepositions. Coding that would be a pain, so how about a module? Rob use strict; use warnings; use Text::Capitalize; print capitalize_title('Regular expression to capitalize first letter

Re: Regular expression to capitalize first letter of words in sentence

2011-04-13 Thread C.DeRykus
On Apr 12, 11:10 pm, shlomit.af...@weizmann.ac.il ("Shlomit Afgin") wrote: > Hi   > > I need to write regular expression that will capitalize the first letter of > each word in the string.   > Word should be string with length that is greater or equal to 3 letters   > exclude the words 'and' and '

Re: Regular expression to capitalize first letter of words in sentence

2011-04-13 Thread Shlomi Fish
Hi Ramprasad, thanks for your answer, but see below for my comments. On Wednesday 13 Apr 2011 14:30:36 Ramprasad Prasad wrote: > On 13 April 2011 11:40, Shlomit Afgin wrote: > > Hi > > > > > > I need to write regular expression that will capitalize the first letter > > of each word in the stri

Re: Regular expression to capitalize first letter of words in sentence

2011-04-13 Thread Ramprasad Prasad
On 13 April 2011 11:40, Shlomit Afgin wrote: > > > > > Hi > > > I need to write regular expression that will capitalize the first letter of > each word in the string. > Word should be string with length that is greater or equal to 3 letters > exclude the words 'and' and 'the'. > > > I tried: > $

Re: Regular expression to capitalize first letter of words in sentence

2011-04-13 Thread John W. Krahn
Shlomit Afgin wrote: Hi Hello, I need to write regular expression that will capitalize the first letter of each word in the string. Word should be string with length that is greater or equal to 3 letters exclude the words 'and' and 'the'. I tried: $string = lc($string); $string =~ s/\b(\

Regular expression to capitalize first letter of words in sentence

2011-04-13 Thread Shlomit Afgin
Hi I need to write regular expression that will capitalize the first letter of each word in the string. Word should be string with length that is greater or equal to 3 letters exclude the words 'and' and 'the'. I tried: $string = lc($string); $string =~ s/\b(\w{3,}[(^the|^and)])\b

Regular expression to capitalize first letter of words in sentence

2011-04-13 Thread Shlomit Afgin
Hi I need to write regular expression that will capitalize the first letter of each word in the string. Word should be word that her length is greater or equal to 3 letters exclude the words 'and' and 'the'. I tried: $string = lc($string); $string =~ s/\b(\w{3,}[(^the|^and)])\b/ucfir