You are here: Re: regex NOT at beggining of string « PHP Language « IT news, forums, messages
Re: regex NOT at beggining of string

Posted by brendan on 09/13/05 17:18

"Oli Filth" <catch@olifilth.co.uk> wrote in message
news:1126616413.069389.128200@g44g2000cwa.googlegroups.com...
> brendan wrote:
> > Want to encode plain email addresses but NOT email addresses in
hyperlinks
> > therefore regex match email addresses that dont have 'mailto:' at
begining
> > ... however can't seem to quite get it to work.

> Read about negative assertions in the PHP manual regex syntax page:
> http://www.php.net/manual/reference.pcre.pattern.syntax.php.
>

hmmm, I did that but no luck, I understand the concept from perl, but I
can't seem to tranlate it to working PHP code
i.e -
return preg_replace('/(?<!mailto)([_\\.0-9a-z-]+)@([_\\.0-9a-z-]+)/i',
"<script>document.write('<a
href=\'mailto:'+'\\1'+'@'+'\\2'+'\'>'+'\\1'+'@'+'\\2'+'</a>');</script>",$st
ring );

chokes.
b.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация