Re: [PHP] how to seek and convert an email address to mailto link

2002-03-20 Thread Pekka Saarinen

At 3/20/2002, you wrote:
$newstr = preg_replace('/\b(\S+@\S+)\b/',
'a href=mailto:\1;\1/a', $oldstr);

Take the time to learn Perl-style regular expressions. You can practically
write Photoshop with them.

miguel

Thanks! It seems to work fine.
If I had time I'd try to learn regexp, but first I'll have to learn how not 
to be busy all the time.

Pekka


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] how to seek and convert an email address to mailto link

2002-03-19 Thread Pekka Saarinen

Hi,

I need to search text for @ and replace the mail address around it (i.e. 
text between previous and following spaces) so that if I have text

Foobar foobar [EMAIL PROTECTED] foobar foobar.

It'll convert it to

Foobar foobar a href=mailto:[EMAIL PROTECTED];[EMAIL PROTECTED]/a foobar foobar.

Anyone?

Thanks,

Pekka


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] how to seek and convert an email address to mailto link

2002-03-19 Thread RIVES Sergio

Hi,
I think the following lines could help you :

$line = Foobar foobar [EMAIL PROTECTED] foobar foobar;
list($var1,$var2,$var3,$var4,$var5) = explode( ,$line);
echo $var1 $var2 a href=mailto:$var3;$var3/a. .$var4. .$var5;
more or less... i am a newbie in this stuff...
hope it helps you

SR



Pekka Saarinen a écrit :

 Hi,

 I need to search text for @ and replace the mail address around it (i.e.
 text between previous and following spaces) so that if I have text

 Foobar foobar [EMAIL PROTECTED] foobar foobar.

 It'll convert it to

 Foobar foobar a href=mailto:[EMAIL PROTECTED];[EMAIL PROTECTED]/a foobar foobar.

 Anyone?

 Thanks,

 Pekka

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] how to seek and convert an email address to mailto link

2002-03-19 Thread Pekka Saarinen

At 3/19/2002, you wrote:
Hi,
I think the following lines could help you :

$line = Foobar foobar [EMAIL PROTECTED] foobar foobar;
list($var1,$var2,$var3,$var4,$var5) = explode( ,$line);
echo $var1 $var2 a href=mailto:$var3;$var3/a. .$var4. .$var5;
more or less... i am a newbie in this stuff...
hope it helps you

I need to parse big texts (from SQL), so I think the best solution would be 
some regexp - only thing is that I have no clue on rexexps


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] how to seek and convert an email address to mailto link

2002-03-19 Thread Miguel Cruz

On Tue, 19 Mar 2002, Pekka Saarinen wrote:
 I need to search text for @ and replace the mail address around it (i.e. 
 text between previous and following spaces) so that if I have text
 
 Foobar foobar [EMAIL PROTECTED] foobar foobar.
 
 It'll convert it to
 
 Foobar foobar a href=mailto:[EMAIL PROTECTED];[EMAIL PROTECTED]/a foobar foobar.

(warning: untested)

$newstr = preg_replace('/\b(\S+@\S+)\b/',
   'a href=mailto:\1;\1/a', $oldstr);

Take the time to learn Perl-style regular expressions. You can practically 
write Photoshop with them.

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php