A positive expression matches the attribute value of an html Tag.
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:
<Circle id = "ap_test" cx = "200" cy = "2000" r = "2" stroke = "black" stroke-width = "0" fill = "red "/>
<Circle id = "ap_test" cx = "201" cy = "2001" r = "2" stroke = "black" stroke-width = "0" fill = "red "/>
<Circle id = "ap_test" cx = "202" cy = "2002" r = "2" stroke = "black" stroke-width = "0" fill = "red "/>
<Circle id = "ap_test" cx = "203" cy = "2003" r = "2" stroke = "black" stroke-width = "0" fill = "red "/>
You need to obtain the cx and cy attribute values of the <circle/> label. After thinking about it, write:
$ 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.