A positive expression matches the attribute value of an html tag. tutorial on expression attribute value _ PHP

Source: Internet
Author: User
A positive expression matches the attribute value of an html tag. A positive expression matches the attribute value of an html tag. the expression attribute value needs to obtain the attribute value of an html tag due to work requirements. the regular expression is immediately generated. the tag is as follows: a positive expression matches the attribute value of an html tag, expression attribute value

Today, due to work requirements, we need to get the attribute values of html tags. now we think of a regular expression. the tags are as follows:




Required The cx and cy attribute values of the tag. after thinking about it, I wrote one:

$ Circle is the content of the above circle label

Preg_match_all ('/<\ s * circle \ s + [^>] *? Cx \ s * = \ s * (\ '| \")(.*?) \ 1 [^>] *? Cy \ s * = \ s * (\ '| \")(.*?) \ 1 [^>] *? \/? \ S *>/I ', $ circle, $ arr );

Var_dump ($ arr );

$ Arr [2] is the cx value, and $ arr [4] is the cy value.



Today, due to work requirements, the author needs to obtain the attribute value of the html tag and immediately thinks of a regular expression. the tag is as follows :...

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.