vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Parsing for emails (https://vborg.vbsupport.ru/showthread.php?t=2969)

09-05-2000 06:15 PM

Can anyone whip up a quick hack which parses the contents of a message for an email address (probably looking for the @ sign) and automatically adds the email tags to it, similarly to automatically parsing for URL's.

09-06-2000 01:21 PM

I believe that
Code:

$messagetext = eregi_replace("([_a-z0-9-]+(\.[_a-z0-9-]+)*)@([a-z0-9-]+(\.[a-z0-9-]+)*)","<A HREF=\"mailto:\\1@\\3\">\\1@\\3</A>",$messagetext);
will work. This one does not do any validation; it just looks for something@something. You might also try throwing some weird addresses at it to see if the \\1@\\3 part remains valid for all forms of "." separated names.

09-06-2000 11:17 PM

That seems to have worked great. It only works if HTML is on in a forum, otherwise it prints the tags.
Thanks!

09-07-2000 04:07 PM

You can better do it this way to keep up the consistency with Vb, in this case it doesn't matter if html is turned on or off:

Code:

$messagetext = eregi_replace("([_a-z0-9-]+(\.[_a-z0-9-]+)*)@([a-z0-9-]+(\.[a-z0-9-]+)*)","[_email]\\1@\\3[/_email]",$messagetext);
untested but I think it'll work

NB: Replace _email with email (twice)

[Edited by Mas*Mind on 09-07-2000 at 01:09 PM]


All times are GMT. The time now is 05:14 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01133 seconds
  • Memory Usage 1,709KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete