Seek the regular! Great God, save my brother.

Source: Internet
Author: User
Seek the regular! The great God help me ....
$STR = "111 <第一饭煲> - <电饭煲海不复当年许多下挫> |2212 <德国的花> |1321 <不复电线饭煲杆分别当年> 424| <苏当年丹公司订不复购饭煲> 5| ";

$reg = "Rice cooker";
$reg 1 = "no longer";
$reg 2 = "Year";

Preg_match_all ("/([0-9]+) < (. *". $reg. ". * ". $reg 1.". *) >\|/isu ", $str, $arr);
Print_r ($arr);

Ask only match 1 out of rice cooker Sea No more that year many fell 2 no wire rice pot rod respectively that year 3 Su Dan Company ordered not to buy rice pot
------Solution--------------------
$STR = "111
 
        <第一饭煲>
  
         
------Solution--------------------
9 <电饭煲海不复当年许多下挫>
------Solution--------------------
2212 <德国的花>
------Solution--------------------
1321 <不复电线饭煲杆分别当年> 424
------Solution--------------------
<苏当年丹公司订不复购饭煲> 5
------Solution--------------------
";

$reg = "Rice cooker";
$reg 1 = "no longer";
$reg 2 = "Year";
$SP = Explode ('
------Solution--------------------
', $STR);
$INARR = Array ();
foreach ($sp as $key = = $value) {
if (Strpos ($value, $reg)!== false && Strpos ($value, $reg 1)!== false && Strpos ($value, $reg 2)!== false) {
Array_push ($INARR, $value);
}
}
Var_dump ($INARR);

------Solution--------------------
$s = "111
 
        <第一饭煲>
  
         
------Solution--------------------
9 <电饭煲海不复当年许多下挫>
------Solution--------------------
2212 <德国的花>
------Solution--------------------
1321 <不复电线饭煲杆分别当年> 424
------Solution--------------------
<苏当年丹公司订不复购饭煲> 5
------Solution--------------------
";

Preg_match_all ('/(?<=<) ([^
------Solution--------------------
>]* (?:(?: Rice Cooker
------Solution--------------------
No longer
------Solution--------------------
year) [^
------Solution--------------------
>]*) {3}[^
------Solution--------------------
>]*) >/u ', $s, $r);
Print_r ($r [1]);
Array
(
[0] = Rice Cooker Sea No longer the year many fell
[1] = + no wire rice cooker rod respectively that year
[2] = Su Dan Company ordered to buy rice pot
)
  • Related Article

    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.