Perl: Regular Expressions Examples

Capitalise each word.

Use the following substitution:


s/(\w*)/\u\L\1/g;

\w* represents a word.

\L means lowercase the whole word.

\u means uppercase the first letter of the word.

Published: Friday, 30 April 2004