Syntax: int ereg (string pattern, string string [, array regs])
Description:
Search string to show the normal representation of pattern.
If a match is found, the third parameter regs is called, and the result of the comparison is stored in the regs element, $regs [1] is a partial string that conforms to the first left bracket (parenthesis), $regs [2] is a partial string that conforms to the second bracket, and so on, $regs [ 0] is an argument string.
If Ereg () finds the alignment, the $regs is filled with 10 elements, even if it is more than or less than 10 parentheses, and can be compared, which does not affect the ability of ereg () to compare to more partial strings. If you do not, $regs will not be ereg () change.
Search is case-sensitive.
Returns True if the string is more than pattern, and returns false if it is less than or if an error occurs.
The following example cuts the date format yyyy and displays it as a DD.MM.YYYY format.
Example:
<?php
if (Ereg ([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}), $date, $regs)) {
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.