How to handle regular expressions

Source: Internet
Author: User
Who can help me extract the following three pieces of data using regular expressions in the following code? First, in alt = & quot; Mico & quot;, the second is: & lt; spanclass = & quot; imo & quot; & gt; 7732078 & lt; /span & gt sincerely ask for regular expressions
Who can help me extract the following three pieces of data using regular expressions in the following code?
First, alt = "Mico" in the Mico
2: 7732078 in 7732078
Third: A 14 in A 14



7732078


A 14


7528398


A 15



Thank you.

------ Solution --------------------
PHP code
  A 14 7528398
A 15 HTML; preg_match_all ('/alt = "(.*?) "| Class =" imo "> (.*?) <| Vessel-name "> (.*?) ------ Solution --------------------
$ Re1 = '/alt = "[a-zA-Z] * [^"]/I ';
$ Re2 = '/\ d * [^ \ <]/I ';
$ Re3 = '/[a-zA-Z0-9] * [^ \ <]/I ';
$ Match = '';
Preg_match_all ($ re1, $ str, $ match );
Echo'
';
Print_r ($ match );
The first $ re1 has a problem. you have to think about it.

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.