New users seek advice ~ Why do I feel useless about the regular expression pattern modifier e?
Source: Internet
Author: User
New users seek advice ~ Why do I feel useless about the regular expression pattern modifier e? For example, the two pieces of code match the URL link in the string. this is the pattern modifier e: $ urlPattern & nbsp ;=& nbsp; "/(www. | https? : \/| Ftp: \/| news: \/| telnet: \/) {1} ask for advice ~ Why do I feel useless about the regular expression pattern modifier e?
For example, the two codes match the URL link in the string.
The output results are the same ~
All of them are replacing www.php.com with php.com.
I think that's just a matter of double quotation marks ,,,
Instead, it's easier to use e.
What is e? Regular PHP sharing:
------ Solution --------------------
E (PREG_REPLACE_EVAL)
If this modifier is set, preg_replace () will evaluate and execute the replaced string as php code (eval function mode) after the replacement string is replaced by a reference ), and use the execution result as the string to be replaced. Single quotation marks, double quotation marks, backslash (\), and NULL characters are escaped by backslash when being replaced by backward references.
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.