regex - How to make only the first character in each word uppercase in Perl -



regex - How to make only the first character in each word uppercase in Perl -

this question has reply here:

how can capitalize first letter of each word in string in perl? 9 answers

i have string containing uppercase words , want create first letter of each word uppercase or convert first character lowercase. i've been messing around regex while , can't right.

my $str = "foobar foobar"; $str =~ s/(\s+)/\u\l$1/g; print $str;

output

foobar foobar

check ucfirst , lc in perldoc.

regex string perl

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

ubuntu - Bash Script to Check That Files Are Being Created -