Please refer to the following link for a regular expression:-php Tutorial.

Source: Internet
Author: User
Tags sodium
Ask a question about the regular expression ~ I want to develop a News collection program and use curl to collect HTML code. I want to use a regular expression to separate the data I need, for example: & lt; table & nbsp; cellspacing0 & nbsp; cellpadding0 & nbsp; bgcolor # FFCCCC & nbsp; ask a question about regular expressions ~
I want to develop a News collection program and use curl to collect HTML code.
I want to use a regular expression to split the data I need
For example:






Keywords: mustard diet



Amaranth, also known as water chestnut, angle SLB, chicken heart dish, amaranth, etc., is a light green open white flowers of the herb, not only delicious wild food, but also has a variety of functions of traditional Chinese medicine. It is highly active and widely distributed, and can be mined everywhere in spring. As a wild dish, there are many cooking methods for this dish. it can be mixed with salad, fried, braised, and soup. It can also be used for filling. it is a rare green product in spring.


As a drug, it has been recorded in the Materia Medica monographs, such as Qianjin Fang food governance, famous medical recording, and Yunnan Materia Medica. Its sexual flavor, sweet, light, and cold, can be used in the liver, spleen, stomach, bladder; with cooling liver damage control, flat liver eyesight, heat and dampness effect; it is used for the treatment of vomiting blood, blood stasis, hemoptysis, urine blood, collapse, eye swelling and pain, fundus hemorrhage, cold and fever, hypertension, chibaile disease, nephritis and edema, chymuuria and other diseases. For example, for internal injuries, 30 grams of water and served with amaranth and canonicalized dates, 30 grams of water and served with amaranth and 30 grams of Longtooth grass, and 125 grams of water were used for the treatment of urine and blood, adjust the winter honey suit or add 3 grams of brown charcoal Chen; treatment of hypertension with amaranth, Prunella each 30 grams of water decoction.


Modern pharmacological research has proved that Amaranth contains oxalate, gallic acid, Apple acid, acetone acid, P-amino benzene acid and other organic acids and a variety of amino acids, it also contains the following components: Cholesterol, acetyl chloride, mannitol, potassium, calcium, sodium, chlorine, phosphorus and manganese. The experimental study found that: Amaranth decoction and extract can make the uterus excited on mice, cats and rabbits. Alcohol extract can reduce blood pressure in dogs, cats, rabbits and rats. Extract can relax the coronary vessels of dogs and guinea pigs, inhibit the human-induced gastric ulcer in rats, and induce diuretic effect on mice. Clinical Practice has proved that amaranth has a peaceful taste, has a wide range of uses and good curative effect, and is widely used and can be safely used.




Source:





I want to get

Amaranth, also known as water chestnut, angle SLB, chicken heart dish, amaranth, etc., is a light green open white flowers of the herb, not only delicious wild food, but also has a variety of functions of traditional Chinese medicine. It is highly active and widely distributed, and can be mined everywhere in spring. As a wild dish, there are many cooking methods for this dish. it can be mixed with salad, fried, braised, and soup. It can also be used for filling. it is a rare green product in spring.


As a drug, it has been recorded in the Materia Medica monographs, such as Qianjin Fang food governance, famous medical recording, and Yunnan Materia Medica. Its sexual flavor, sweet, light, and cold, can be used in the liver, spleen, stomach, bladder; with cooling liver damage control, flat liver eyesight, heat and dampness effect; it is used for the treatment of vomiting blood, blood stasis, hemoptysis, urine blood, collapse, eye swelling and pain, fundus hemorrhage, cold and fever, hypertension, chibaile disease, nephritis and edema, chymuuria and other diseases. For example, for internal injuries, 30 grams of water and served with amaranth and canonicalized dates, 30 grams of water and served with amaranth and 30 grams of Longtooth grass, and 125 grams of water were used for the treatment of urine and blood, adjust the winter honey suit or add 3 grams of brown charcoal Chen; treatment of hypertension with amaranth, Prunella each 30 grams of water decoction.


Modern pharmacological research has proved that Amaranth contains oxalate, gallic acid, Apple acid, acetone acid, P-amino benzene acid and other organic acids and a variety of amino acids, it also contains the following components: Cholesterol, acetyl chloride, mannitol, potassium, calcium, sodium, chlorine, phosphorus and manganese. The experimental study found that: Amaranth decoction and extract can make the uterus excited on mice, cats and rabbits. Alcohol extract can reduce blood pressure in dogs, cats, rabbits and rats. Extract can relax the coronary vessels of dogs and guinea pigs, inhibit the human-induced gastric ulcer in rats, and induce diuretic effect on mice. Clinical Practice has proved that amaranth has a peaceful taste, has a wide range of uses and good curative effect, and is widely used and can be safely used.



How do I write a regular expression? If that great God knows, please give me some advice. thank you ~~

Regular expression PHP html


------ Solution --------------------
Preg_match_all ('/

(. +) <\/P>/sU ', $ s, $ m );
Print_r ($ m );
------ Solution --------------------
If you want to capture data stably, we recommend that you remove all html tags, keep only the text, and break the text into an array, the advantage of this approach is that the website of the other party has some small adjustment actions that will not affect your crawling.

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.