php tutorial Regularly specify the contents of the string Preg_match function description Although the code is small, but the code is as simple as the following:
preg_match ('/ ^ (?! string) /', 'aa') === true This is used to verify that a string is not 'string' In perl or regular expressions that support perl (such as php), you can do this with a look-ahead declaration, which is: The code is as follows:
preg_match ('/.* (?!. txt) $ /', 'aa') Means to match all names that do not end in .txt
preg_match - Perform regular expression matching instructions int preg_match (string pattern, string subject [, array matches [, int flags]])
Search in the subject string for the pattern matching the regular expression.
If matches is provided, it will be filled by the result of the search. $ matches [0] will contain the text that matches the entire pattern, $ matches [1] will contain the text that matches the subpattern in the first captured bracket, and so on
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.