Thanks! I didn't know those variables were local by default. It works now.

I'm sure you can all undoubtably see what I'm trying to acheive: take some text 
that's stored in a variable and output it to the browser w/ all the urls in that 
text (if any) hyperlinked with their respective address. I'm sure there's a 
better way to do this. My code only does it's thing for one occurance of a url.

As I'm looking at the messages in this embperl discussion, I notice that any 
urls that are present are hyperlinked. Gerald? (I assume he made this)

>X-UIDL: 3d18742e5e09c0dd20b0cb3af1edf32d
>Date: Wed, 18 Oct 2000 16:47:27 -0700
>From: ___cliff rayman___ <[EMAIL PROTECTED]>
>X-Accept-Language: en
>MIME-Version: 1.0
>To: Gavin Spomer <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
>Subject: Re: Embperl And Matching
>Content-Transfer-Encoding: 7bit
>
>embperl is really not doing anything special, but the [$ $] blocks are not in
>the same scope as the [+ +] blocks. use a global variable to capture the values
>so it is available in the other blocks.
>
>try:
>[$ if @regex=($text =~ /(.*\s)(http\:\/\/\S+)(\s.*)/i) $]
>        [+ $regex[0] +]<a href="[+ $regex[0] +]">[+ $regex[1] +]</a>[+ 
$regex[2] +]
>
>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 $]
>>
>>
>
>--
>___cliff [EMAIL PROTECTED]http://www.genwax.com/
>
>


- 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]

Reply via email to