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're asking:<br><br><br>my $url = "<a href="http://www.FOo.COm/wibbLE">http://www.FOo.COm/wibbLE</a>";<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 ' does not cause it's contents to be interpolated, you need to use ".<br>
<br>Neil<br><br><br><div class="gmail_quote">2010/10/25 James Bromberger <span dir="ltr"><<a href="mailto:james@rcpt.to">james@rcpt.to</a>></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'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 = '<a href="http://www.FOo.COm/wibbLE" target="_blank">http://www.FOo.COm/wibbLE</a>';</tt></font><br>
<tt><font color="#000099">my $search = '^([^:]+://[^/]+)/?(.*)?$';<br>
my $replace = '\L$1\E/$2';<br>
print $url if </font></tt><font color="#000099"><tt>$url =~
/$search/$replace/;</tt></font><br>
<br>
Sadly, the result is the literal "<b>\L$1\E/$2</b>".<br>
<br>
Limitation is that I don't want to use eval() (also known as /e, and
/ee), as I don't trust the content of $replace - fine if it doesn'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 '<b>lc($1)
. "/$2"</b>'.)<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> -> @)</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>