Hi James,<br>You can pull out the match (i.e. $1) and pass it through a tr, which should achieve your goal.<br><br>Something like the following does what you&#39;re asking:<br><br><br>my $url = &quot;<a href="http://www.FOo.COm/wibbLE">http://www.FOo.COm/wibbLE</a>&quot;;<br>
$url =~ m|(\w+)://([^/:]+)(:\d+)?/(.*)|;<br>my $protocol = $1;<br>my $domainName = $2;<br>$uri= $4;<br>$domainName=~tr/A-Z/a-z/;<br><br>Note that a &#39; does not cause it&#39;s contents to be interpolated, you need to use &quot;.<br>
<br>Neil<br><br><br><div class="gmail_quote">2010/10/25 James Bromberger <span dir="ltr">&lt;<a href="mailto:james@rcpt.to">james@rcpt.to</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


  

    
  
  <div bgcolor="#ffffff" text="#000000">
    Hi all,<br>
    <br>
    I&#39;m trying to to a substitution on a URL to lower-case the the
    protocol and host name in one regex, using variables for either side
    of the substitution:<br>
    <font color="#000099"><tt>my $url = &#39;<a href="http://www.FOo.COm/wibbLE" target="_blank">http://www.FOo.COm/wibbLE</a>&#39;;</tt></font><br>
    <tt><font color="#000099">my $search = &#39;^([^:]+://[^/]+)/?(.*)?$&#39;;<br>
        my $replace = &#39;\L$1\E/$2&#39;;<br>
        print $url if </font></tt><font color="#000099"><tt>$url =~
        /$search/$replace/;</tt></font><br>
    <br>
    Sadly, the result is the literal &quot;<b>\L$1\E/$2</b>&quot;.<br>
    <br>
    Limitation is that I don&#39;t want to use eval() (also known as /e, and
    /ee), as I don&#39;t trust the content of $replace - fine if it doesn&#39;t
    nicely do a replace, bad if the eval() does a call to unlink and
    friends. (Of course, with using eval the $replace could contain &#39;<b>lc($1)
      . &quot;/$2&quot;</b>&#39;.)<br>
    <br>
    Any ideas? <br>
      James<br><font color="#888888">
    <br>
    <div>-- <br>
      <b>James Bromberger</b><br>
      Aus Mobile: +61 422 166 708<br>
      Email: james <i>_AT_</i> <a href="http://rcpt.to" target="_blank">rcpt.to</a>, Web: <a href="http://www.james.rcpt.to/" target="_blank">www.james.rcpt.to</a><br>
      MSN: james<i>_AT_</i><a href="http://rcpt.to" target="_blank">rcpt.to</a>, AIM: JamesEBromberger, Skype:
      james.bromberger
      <small>(<i>_AT_</i> -&gt; @)</small></div>
  </font></div>

<br>_______________________________________________<br>
Perth-pm mailing list<br>
<a href="mailto:Perth-pm@pm.org">Perth-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/perth-pm" target="_blank">http://mail.pm.org/mailman/listinfo/perth-pm</a><br></blockquote></div><br><br clear="all"><br>-- <br>Neil Hunt<br>Senior Consultant<br>HuntCorp Enterprises<br>
Phone: 0412 474 140<br><br>