我需要从HTML解析一些值。
You can't parse (X)HTML with RegEx , so don't do it. You need to use a proper parser that will build you a Document Object Model (DOM). As you have tagged your question with JavaScript, I recommend that you use jQuery to build an object graph of your HTML, simply like this:
var $document = $(html);
This $document
object can now be operated on with methods like $document.find()
to dig out the elements you want from the HTML.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.