Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: replacing part of a string with its uppercase via regex

by choroba (Cardinal)
on Mar 16, 2014 at 21:44 UTC ( [id://1078552]=note: print w/replies, xml ) Need Help??


in reply to replacing part of a string with its uppercase via regex

The second part of a substitution is just a plain string, not a regular expression. To include a part from the matched string, you have to use capture groups, introduced by parentheses. To uppercase a part of a string, use \U:
$this_term =~ s/\.([a-z])/.\U$1/g;
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1078552]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-25 17:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found