Regular Expression Matching function

Source: Internet
Author: User
At the end of this post, Jackdowson123 edited $ data = mb_convert_encoding ($ data, & nbsp; "UTF-8", & nbsp; "gb2312") from 2013-06-2200:36:32 "); & nbsp; regular expression matching function
This post was last edited by Jackdowson123 at 00:36:32 $ data = mb_convert_encoding ($ data, "UTF-8", "gb2312 ");
Preg_match_all ('/\> (\-? \ D + \. \ d +) \ <\/font \>/', $ data, $ matches );
Return var_dump ($ matches );



$ Data ='

Dormitory power remaining query result










As of this morning, the power remaining in 22 416 bedroom buildings: 20.34 degrees.



(Query operation Execution time)



Note:
(1) normally, the electricity management system automatically reads data from AM to am every day, obtains the power consumption since am the previous day, and calculates the remaining power. if the remaining power is less than or equal to 0 degrees, the power supply stops waiting for the user to renew the electricity bill.
(2) after the electricity fee is paid off, the system generally supplies power 10 minutes later.




Close








'

Why is a null value returned here, and if $ data = '20. 34 degrees. ', but 20 can be returned. 34. does anyone know why? share regular HTML :(\-? \ D + \ .. \... 'data-pics = ''>
------ Solution --------------------
Preg_match_all ('/\> (\-? \ D + \. \ d +) \ <\/font \>/I ', $ data, $ matches );

I case-insensitive

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.