Hey, how can I write two regular expressions into one?-php Tutorial

Source: Internet
Author: User
Ah, how can I write two regular expressions into a regular expression? thank you! This post was last edited by cluonani from 2013-05-1314: 40: 09. this is the content to be matched & lt; td & nbsp; & gt; Primary & nbsp; Color: & lt; td & gt; & lt; td & nbsp; & gt; alas, how can I combine two regular expressions into one? thank you.

This post was last edited by cluonani at 14:40:09

This is the content to match


Primary Color:


Multi-Color




Multi Pack Indicator:


No




Battery Type:


Does Not Contain a Battery




How can I combine this regular expression into one?

$a = preg_match_all('/LightRowHead.*?>(.*?):.*?LightRow.*?>(.*?)$a = preg_match_all('/DarkRowHead.*?>(.*?):.*?DarkRow.*?>(.*?)

This is not the case.

$a = preg_match_all('/[LightRowHead|DarkRowHead].*?>(.*?):.*?[LightRow|DarkRow].*?>(.*?)


Please advise

Share To: Primary? Color: Multi-Color


------ Solution --------------------
(Xx
------ Solution --------------------
Yy)
------ Solution --------------------
It is changed to a single character when enclosed in square brackets. it must be enclosed in parentheses.
$ A = preg_match_all ('/(LightRowHead
------ Solution --------------------
DarkRowHead). *?> (.*?) :.*? (LightRow
------ Solution --------------------
DarkRow). *?> (.*?)If you don't want to add a forward reference, you can write it.
$ A = preg_match_all ('/(? : LightRowHead
------ Solution --------------------
DarkRowHead). *?> (.*?) :.*? (? : LightRow
------ Solution --------------------
DarkRow). *?> (.*?)
If you need to be paired, you can write.
$ A = preg_match_all ('/(LightRow
------ Solution --------------------
DarkRow) Head. *?> (.*?) :.*? \ 1. *?> (.*?)

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.