# ereg\_replace bug?

**URL:** <https://forum.kirupa.com/t/ereg-replace-bug/93717>\
**Category:** Uncategorized\
**Created:** [November 4, 2003, 3:22am UTC](https://forum.kirupa.com/t/ereg-replace-bug/93717 "2003-11-04T03:22:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![comicGeek](https://avatars.discourse-cdn.com/v4/letter/c/90db22/32.png) [@comicGeek](https://forum.kirupa.com/u/comicGeek)\
**Post date:** [November 4, 2003, 3:22am UTC](https://forum.kirupa.com/t/ereg-replace-bug/93717/1 "2003-11-04T03:22:18Z")

</div>

I am making a Flash/PHP Guestbook! I have successfully done so but the automatic parsing of emails and urls have some problems! I am using ereg\_replace() to search for and parse urls and email address but when a user has an email like [some\_guy@someguys.com](mailto:some_guy@someguys.com) it only considers the part after the underscore thus displaying the wrong email address: in this case would be [guy@someguys.com](mailto:guy@someguys.com)!

Here’s the script I used!

```php

$link = ereg_replace("[[:alpha:]]+@[^<>[:space:]]+
[[:alnum:]]","<a href=\"mailto:\\0\"><u>".$name."</u></a>", $link);

```

Hope you can help me!
