Regular Expression Analysis JS

Source: Internet
Author: User
Int result (string website) // returns the numeric ID in Js.

{

String html = getpagecodes ("http://www.pcpop.com/"); // call the previous capture pageSource codeMethod

String zipregexpop = @ "\/ashow .*? \. Js "; // Regular Expression matching Js. Adjust the regular expression according to different situations, for example :\/.*? \. JS, matching all. js files on the page

JS = getpagecode. getjs (HTML, zipregexpop); len1 = Js. lastindexof ('/'); len2 = Js. lastindexof ('. '); len1 = len1 + 1; pageid = int. parse (JS. substring (len1, len2-len1); Return pageid;

}

This is a simple method to capture the page source.CodeThen, obtain the desired show/*/. js file and perform some specific analysis.

Different JavaScript codes can be obtained based on specific needs, because each JS plays a different role. It seems like it is nonsense.

The above function is implemented based on the task URL to obtain a special JS contained in the source code, which can be expanded according to the specific needs, throwing a stone here

 

 

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.