javascript - How to match this text using regular expressions

WBOY
Release: 2023-03-02 11:48:01
Original
1122 people have browsed it

"

1 You don’t need to press the goods, there is zero inventory, we will ship it for you.
2 Our company mainly focuses on wholesale, with low profits and preferential treatment for large quantities. .
3 Our factory produces shoes independently, no markings or OEMs
4 7 days for returns and 15 days for exchanges, requirements:
(1) Does not affect secondary sales
(2) No out-of-season products will be accepted
5 Odor. , color difference, accessories that are easy to fall off, glue stains in inconspicuous places, scratches that cannot be clearly distinguished by the naked eye from a distance of 1.5 meters, or small flaws that do not affect wearing, are not quality issues. The shoes are only processed from the factory, and some shoes are definitely There is a slight smell and it will disappear after a day or two in a ventilated place. Everyone's monitor is different and the lighting problem when taking pictures may cause slight color difference.

"

How to use regular expression to match the content in this p tag? I only want what is included in the p tag. There may be span tags, strong tags, etc. in the p tag. I also want these. And the p tag may have other attributes such as class, style, etc.

I only want the text contained by the p tag.

Please tell me how to use regular matching?

Reply content:

"

1 You don’t need to press the goods, there is zero inventory, we will ship it for you.
2 Our company mainly focuses on wholesale, with low profits and preferential treatment for large quantities. .
3 Our factory produces shoes independently, no markings or OEMs
4 7 days for returns and 15 days for exchanges, requirements:
(1) Does not affect secondary sales
(2) No out-of-season products will be accepted
5 Odor. , color difference, accessories that are easy to fall off, glue stains in inconspicuous places, scratches that cannot be clearly distinguished by the naked eye from a distance of 1.5 meters, or small flaws that do not affect wearing, are not quality issues. The shoes are only processed from the factory, and some shoes are definitely There is a slight smell and it will disappear after a day or two in a ventilated place. Everyone's monitor is different and the lighting problem when taking pictures may cause slight color difference.

"

How to use regular expression to match the content in this p tag? I only want what is included in the p tag. There may be span tags, strong tags, etc. in the p tag. I also want these. And the p tag may have other attributes such as class, style, etc.

I only want the text contained by the p tag.

Please tell me how to use regular matching?

<code>/^<p[^>].*>(.*)</p>&/</code>
Copy after login

php uses preg_match_all

by the way, php should be wrapped in quotation marks

js uses match(/regex above/g)

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!