in reply to Call for code samples!
Somewhat hastily reconstructed out of memory. It's a little more optimized in the code, I believe. It's also a very nice way to handle more complex transformations.$text =~ s/\[([^\]]+)\]/parseLink($1)/eg; sub parseLink { my $link = shift; my ($type, $title); ($type, $link, $title) = $link =~ m!(.+)://(.+)|(.+)!; $type ||= ''; $title ||= $link; return makeLink($link, $title, $type); }
|
|---|