In many high-level languages,Syntax: int ereg (string pattern, string string, array [regs]);
return value: Integer/array
Function type: Data processing
php function Ereg () content description
This function parses string strings with the rule of pattern. The value returned from the result is placed in the array parameter regs, Regs[0] content is the original string, string, Regs[1] is the first rule of the string, Regs[2] is the second rule of the string, and so on. If the parameter regs is omitted, it is simply a comparison, and the return value is true if found.
php function Ereg () Usage Example
Simple example:
- < ? PHP
- if (Ereg ("C", "abcdef")) {
Description: Determine if the abcdef contains the letter C
- echo "Pass";
- }else{
- echo "Error";
- }
- ?>
The following PHP function Ereg () example is to enter the e-mail to make a simple check, check whether the user's e-mail string has an @ character, before the @ character has an English letter or number, after a few strings, the last decimal point can only have two or three English letters. Super@mail.wilson.gs can pass the inspection, Super@mail.wilson cannot pass the examination.
- < ? PHP
- if (Ereg ("^[_.0-9a-z-]+@ ([0-9a-z]
[0-9a-z-]+.) +[a-z]{2,3}$ ", $email))
- {
- echo "Your e-mail through a preliminary check";
- }
- ?>
http://www.bkjia.com/PHPjc/446312.html www.bkjia.com true http://www.bkjia.com/PHPjc/446312.html techarticle in many high-level languages, Syntax: int ereg (string pattern, string string, array [regs]), return value: Integer/Array function type: Data processing PHP function ereg () content description This function with ...