PHP Preg_match reveal warning

Source: Internet
Author: User
PHP preg_match prompt warning.
The code is as follows:
 
  function Isvaliddomain ($domain) {
if (Preg_match ("/^ (HTTP|FTP)://(www\.)?". +\. (com|org|net) $/i ", $domain))
Return $domain. ' is a legal domain name ';
Else
return $domain. ' is not a legal domain name ';
}

Echo Isvaliddomain ("http://www.aixi.com");
?>



Operation Result:
Warning:preg_match (): Unknown modifier '/' in D:\wamp\www\www.yoyou.com\this.php on line 3
Http://www.aixi.com is not a legal domain

Ps:php is version 5.4
------to solve the idea----------------------
"/^ (http
------to solve the idea----------------------
FTP): \/ \/(www\.)?. +\. (COM
------to solve the idea----------------------
Org
------to solve the idea----------------------
NET) $/i "
Or
" #^ (http
------to solve the idea----------------------
FTP)://(www\.)?. +\. (COM
------to solve the idea----------------------
Org
------to solve the idea----------------------
NET) $ #I
------to solve the idea----------------------
For slashes if you don't want to move, use # or @ or! All right
------to solve the idea----------------------
Less meaning, so wrong.
  • Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.