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

Posted by brendan on 09/13/05 14:35

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.

My plain replace does

return eregi_replace( "([_\\.0-9a-z-]+)@([_\\.0-9a-z-]+)",
"<script>document.write('<a
href=\'mailto:'+'\\1'+'@'+'\\2'+'\'>'+'\\1'+'@'+'\\2'+'</a>');</script>",$st
ring );

But I can't work out how to exclude emails with mailto: at beginning hence:

return eregi_replace( "(^[^mailto\\:]+[_\\.0-9a-z-]+)@([_\\.0-9a-z-]+)",
"<script>document.write('<a
href=\'mailto:'+'\\1'+'@'+'\\2'+'\'>'+'\\1'+'@'+'\\2'+'</a>');</script>",$st
ring );

Any help?
brendan.

 

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

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