Select Page

You feed in a string to a regular expression and it comes out in Title Case. As Perl, PHP and ASP use regular expressions, this expression is useful with a little tinkering:

$x =~ s/(\w+)/\u\L$1/g;
$x =~ s/(\sand|of\s)/\L$1/ig if ($x =~ /\sand|of\s/i);

Enjoy!