in reply to Using 'lc' (lowercase) in a reg ex

If you want to use commands in regex, you need to use /e in there.
$newfile =~ s/\b([A-Z]{2,})\b/\\emph{lc($1)}/ge;
Another way would be to use metasymbols
$newfile =~ s/\b([A-Z]{2,})\b/\\emph{\L$1\E}/g;
Code above untested, so might have mistakes.

Replies are listed 'Best First'.
Re: Using 'lc' (lowercase) in a reg ex
by Abigail-II (Bishop) on Apr 29, 2004 at 11:00 UTC
    $newfile =~ s/\b([A-Z]{2,})\b/\\emph{lc($1)}/ge;
    Unless you happen to have a function called emph, that's not going to work. If you want to use /e, write it as:
    $newfile =~ s/\b([A-Z]{2,})\b/'\emph{' . lc ($1) . '}'/eg;

    But I would go for the \L method.

    Abigail