Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: another string replacement with uppercase :: converting C macros to C++

by martin (Friar)
on Jan 23, 2016 at 09:06 UTC ( [id://1153454]=note: print w/replies, xml ) Need Help??


in reply to Re: another string replacement with uppercase :: converting C macros to C++
in thread another string replacement with uppercase :: converting C macros to C++

For uppercasing, of course, there is also the builtin \U.
s/\b__(\w+)__\b/\U$1/;
  • Comment on Re^2: another string replacement with uppercase :: converting C macros to C++
  • Download Code

Replies are listed 'Best First'.
Re^3: another string replacement with uppercase :: converting C macros to C++
by Athanasius (Archbishop) on Jan 23, 2016 at 09:21 UTC

    Good point! I’d forgotten about these (if I ever knew them1) — except for \Q, which I often have to use. For the record, they’re documented here:

    19:11 >perl -wE "my $s = qq[abc\Udef\Eghijk]; say $s;" abcDEFghijk 19:13 >

    Good to know, thanks!

    Update: 1I must have read about them any number of times. But unfortunately it seems that reading about ≠ knowing, unless it’s combined with using. ;-)

    Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-16 20:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found