How to extract code related to pictures in a Web page

Source: Internet
Author: User

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

Because a friend is in urgent need of this information, so I simply said:

Two ways:

1, regular expression, first write the code, I explained in detail.

Pictures are written in the, so as long as the code to find out everything is resolved.

       <%
       function regexptest ( PATRN,&NBSP;STRNG)
       dim regex, match, matches ' establishes variables.
       set regex = new regexp ' establishes regular expressions.
       regex.pattern = patrn ' set mode. The
       regex.ignorecase = true ' settings are case-sensitive.
       regex.global = true ' sets global availability.
       Set matches = regex.execute (strng) ' performs the search.
       for each match in matches ' traverses the matching collection.
       RetStr = RetStr &  Match found  at position 
       RetStr = RetStr  & Match.FirstIndex &  ".   match value is  ' "
       retstr = retstr &  Match.Value &  "'."  &  <BR>
       Next
        REGEXPTEST&NBSP;=&NBSP;RETSTR
       end function
        response.write regexptest "\<img.*?\>", Web page code)

       %>

(AD: Special airfares http://www.99jpw.cn)

The result of running this code is to extract all the code and get all the pictures.

2, split resolution.

Code:

A= Web page Content

B=split (A, "

This way the value of the page content with UBound (b) is the total number of pictures included.

The following extracts the details.

Use a loop.

For I=1 to UBound (b)

C=split (b (i), ">")

C (0) is a picture-related information.

Next

Detailed code to http://www.99zz.org/99zz/wenzhang/?id=41 download.

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.