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

I was looking at the code for a program that contains REs to convert text URLs to hyperlinks and found this funny "-h->" syntax. I've never seen it before and it's been in no documentation I've looked at. Here's the context:

|(anonymous\@)([a-zA-Z][\w\.+\-]+\.[a-zA-Z]{2,}):(\s*)([\w\d+\-/\.]+)| -h-> $1<A HREF="ftp://$2/$4">$2:$4</A>$3
I'm guessing this syntax is from ancient versions of Perl. Am I right?

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar";
$nysus = $PM . $MCF;

Replies are listed 'Best First'.
Re: Strange regular expression syntax
by iakobski (Pilgrim) on Jun 07, 2001 at 14:33 UTC
    That's not regex syntax, that's just a literal

    -h->

    to be found in the target string.

    -- iakobski

Re: Strange regular expression syntax
by chipmunk (Parson) on Jun 07, 2001 at 19:26 UTC
    It looks to me like it's a literal -h-> to be inserted into the target string, as part of the replacement text for a substitution. It's in the same part as $1 et al.

    As far as I can tell, | (vertical bar) is the separator character for the substitution, and the leading s and trailing | are missing from the snippet.