An error occurred while reading a regular expression on the webpage. Let's take a look at the error. It is best to explain the meaning of each symbol. I am learning an example of a regular expression on the webpage, and an error has occurred. Let's take a look at the error. It is best to explain the meaning of each symbol. the div tag is being extracted and the content with the ID of PostContent is stored in the array match. Preg_match ('/& lt refers to an example of a regular expression on the webpage, and an error occurs. Let's take a look at the error. It is best to explain the meaning of each symbol.
An error occurred while reading a regular expression on the webpage. Let's take a look at the error. It is best to explain the meaning of each symbol.
// Retrieve the div tag and the content with the ID of PostContent coexist in the array match.
Preg_match ('/] * id = "PostContent" [^>] *> (.*?) /Si', $ text, $ match );
Is this regular expression perl-style. It is not in the POSIX style. The two learning methods are messy.
I want to understand this.
Error message:
Warning: preg_match () [function. preg-match]: Unknown modifier '/' in D: \ xampp \ htdocs \ testweb02 \ t1.php on line 6
------ Solution --------------------
Preg_match ('/] * id = "PostContent" [^>] *> (.*?) /Si', $ text, $ match );
Change
Preg_match ('/] * id = "PostContent" [^>] *> (.*?) <\/Div>/Si', $ text, $ match );
Or
Preg_match ('/] * id = "PostContent" [^>] *> (.*?) <\/Div>/Si', $ text, $ match );
------ Solution --------------------
I am also a regular expression that I just learned. I don't know how to use it. I don't know if it's what you want.
You can use eregi ("
", $ Content, $ eg );
$ Content = file_get_contents ($ url); $ url is the url of the content website you want to intercept, and $ eg stores the content you want to save.
Then echo $ eg [1]; can retrieve the content. as for $ eg, it is an array and I am not very clear about what it is, you can take a look at the knowledge of eregi functions.