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
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
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
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 '
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
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:
> $
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(\
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
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