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 (Cardinal) 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,