ereg() - Regular expression match

Information for PHP. Hypertext Preprocessor
Post Reply
dzcadii
Posts: 94
Joined: Sun Mar 01, 2015 4:36 am

ereg() - Regular expression match

Post by dzcadii » Sun Mar 01, 2015 6:29 pm

Yes i know right from the manual; but simpler!

The function is ereg();

Description:
int ereg ( string $pattern , string $string [, array &$regs ] )
Searches a string for matches to the regular expression given in pattern in a case-sensitive way.


If you want to see ereg(); for JavaScript viewtopic.php?f=20&t=53
^#(^ **NOT the same (string content can be the same but function/object/method call is different ( -->"RegExp()"))** ^#(^

Code: Select all

$email_address = "some.one@something.us.cu.gov";

/*
Email address patterns accepted:(.com,.net,.edu.,.mil,.gov, etc)

      someone@something.com
      some.one@something.com
      some.one.too@something.com
      someone@some.thing.com
      some.one.too@some.thing.com

*/

$email_address+pattern = "^[a-zA-Z0-9_\.]{2,}@{1}(([a-zA-z]{2,}\.{1}[a-zA-Z]{2,6})|([a-zA-Z]{2,}\.{1}[a-zA-Z]{2,}\.[a-zA-Z]{2,6})|([a-zA-Z]{2,}\.{1}[a-zA-Z]{2,}\.[a-zA-Z]{2,}\.[a-zA-Z]{2,6}))$";

ereg($email_address_pattern,$email_address);

Post Reply