Quantcast
Channel: Squeezebox : Community : Forums
Viewing all articles
Browse latest Browse all 6235

Perl regex and \Q\E

$
0
0
On Thu, 7 May 2020 12:01:58 +0200, Michael Herger <slim (AT) herger (DOT) net> wrote:

> > $x =~ s/\(id\)/\Q$id\E/g;

>
> Heh... I failed! And actually was surprised to see that these would work
> in the replacement expression...
>


Why surprised? \Q and \E are string meta characters and identical to
quotemeta(...).

The fact that they are mostly used in the match part of regexes doesn't
mean they are not useful elsewhere :) .

-- Johan

Viewing all articles
Browse latest Browse all 6235

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>