a01 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I need my Perl script to unescape a JavaScript string literal that is in a <script> tag in HTML code that I need to parse. For example:

<script type="text/javascript"> ('https\x3a\x2f\x2fexample. +com')</script>

If I capture the string with a regular expression, I get the string:


I need to decode this to:

How do I do this in Perl?