On Friday, November 14, 2003, at 07:25 AM, xweb wrote:
Can someone help me about a regular ? In which way i can substitute <a href="$url">string</a> with <idlink>$val1.
I'm not sure I understand exactly what you're asking. Do you mean you want to take the value of $url and place it where $val1 occurs in the substitution string? If that's what you mean, then surround the part of the regex that you want to retain in parentheses and recall it using the $1 ... $9 variables.
Like this:
$test = "<a href=\"http://www.google.com\">Google</a>";
$test =~ s/<a href=\"(http:\/\/www\.google\.com)\">Google<\/a>/<idlink>\1/;
print $test; # test = "<idlink>http://www.google.com"
--Rick Anderson "The only difference between me and a madman, is that I am not mad." -- Salvador Dali