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