Function eregi preg match() is...

php - Deprecated: Function eregi() is deprecated in C:\wamp\ - Stack Overflow
to customize your list.
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
J it only takes a minute:
Join the Stack Overflow community to:
Ask programming questions
Answer and help your peers
Get recognized for your expertise
please when using the eregi() function to validate an email address i got this error:
Deprecated: Function eregi() is deprecated in C:\wamp\www\ssiphone\classes\TraitementFormulaireContact.php on line 13
my code which may make problem is :
public function verifierMail($mail)
if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $mail)) {
return "valid mail";
return "invalid mail";
130k24202364
4,3112173148
the eregi function is deprecated, which means that in future versions of PHP it will be removed.
You can replace it with the function preg_match which does pretty much the same thing.
Sample code (untested):
public function verifierMail($mail)
if(preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $mail)) {
return "valid mail";
echo "invalid mail";
The /i makes it case insensitive
8,21072744
Did you find this question interesting? Try our newsletter
Sign up for our newsletter and get our top new questions delivered to your inbox ().
Subscribed!
Success! Please click the link in the confirmation email to activate your subscription.
use the function preg_match() instead
you can find the php manual page here:
2,48211427
Aside from substituting ereg_* with preg_*, you should consider the builtin
filter_var($mail, FILTER_VALIDATE_EMAIL)
you'll still get false negatives (there are a lot of valid emails you'd never imagine), but it's still better than a poor regexp.
16.9k95091
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
The week's top questions and answers
Important community announcements
Questions that need answers
By subscribing, you agree to the
Stack Overflow works best with JavaScript enabledFunction eregi() is deprecated in /opt/lampp/htdocs/lib.php on line 13_百度知道
Function eregi() is deprecated in /opt/lampp/htdocs/lib.php on line 13
&lt, $str) )/&&}function Error($msg) {echo(&&}function ismail( $str ) {if( eregi(&);_\/0function URL_Refresh($url) { print &url='&[^0-9a-zA-Z]&;
Header(&;/head&head&;);html&gt.alert(\[^0-9a-zA-Z]&&Script&/$msg\ } 13行是 if(eregi(&META HTTP-EQUIV=Refresh CONTENT=\
&;;Script&_\html&}function isAlNum($str) {if(eregi(&/L$url&#39.]+)&&&&&&quot,$str)) return 0;)&#92.go(-1)
&-\-\([a-z0-9&#92,$str)) return 0;;return 1.]+)@([a-z0-9\&quot: $url&quot
我有更好的答案
eregi改preg_match
其他类似问题
为您推荐:
eregi的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁

我要回帖

更多关于 eregi 的文章

 

随机推荐