You know, I tried something like this before and it didn't work, but I think
maybe I might have set $optRawInput to the wrong value. Thanks for your idea. It
makes sense because now I can just add the g to the substitute statement and it
will hyperlink all of the urls.
>
>As I was writing my reply I see ___cliff rayman___ has already responded.
>
>I attempted it with his revised code and it still did not work until I add the
>[- $optRawInput = 1 -] at the top.
>
>Another way to do the process (just because that is what is great about Perl)
is:
>
>[- $optRawInput = 1 -]
>[- $text = 'This: http://www.blah.com is a url'; -]
>[# don't need the if since the value of $text will only change if there #]
>[# is a valid http URL present #]
>[- $text =~ s#(.*\s)(http\:\/\/\S+)(\s.*)#$1<a href="$2">$2</a>$3\n#i -]
>[+ $text +]
>
>Aaron Johnson
>
>Gavin Spomer wrote:
>
>> Does embperl have it's own $1, $2, etc. like the ones captured when using
parenthesis in a matching expression? If not, does embperl do something to these
>> variables produced by the parenthesis (like discard or ignore them)? To
illustrate what I'm talking about here's some embperl code:
>>
>> [- $text = 'This: http://www.blah.com is a url'; -]
>>
>> [$ if $text =~ /(.*\s)(http\:\/\/\S+)(\s.*)/i $]
>> [+ $1 +]<a href="[+ $2 +]">[+ $2 +]</a>[+ $3 +]
>> [$ else $]
>> [+ $text +]
>> [$ endif $]
>>
>> Which, I don't know why, produces the output:
>>
>> <a href=""></a>
>>
>> The equivelant (I think) non-embedded perl code:
>>
>> $text = 'This: http://www.blah.com is a url';
>>
>> if ($text =~ /(.*\s)(http\:\/\/\S+)(\s.*)/i )
>> {
>> print "$1<a href=\"$2\">$2<\/a>$3\n";
>> }
>> else
>> {
>> print "$text\n";
>> }
>>
>> outputs what I am trying to achieve w/ the embperl code:
>>
>> This: <a href="http://www.blah.com">http://www.blah.com</a> is a url
>>
>> so why doesn't the embperl version work?
>>
>> - Gavin
>>
>> "People are the worst drivers in the world"
>> http://www.singlespeedsanonymous.com/
>>
>> Join PayPal and get FIVE FREE DOLLARS (no joke!):
>> https://secure.paypal.x.com/refer/pal=gavinspomer%40hotmail.com
>> ... and it's a very usefull account to have!
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>
- Gavin
"People are the worst drivers in the world"
http://www.singlespeedsanonymous.com/
Join PayPal and get FIVE FREE DOLLARS (no joke!):
https://secure.paypal.x.com/refer/pal=gavinspomer%40hotmail.com
... and it's a very usefull account to have!
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]