简体   繁体   中英

PHP regular expression to extract number from html code

In an html source code with a fragment like this:

of <span class="important">721,006</span>

I want to extract number 721,006 . There could be more than one so I need the word "of" to get the real one.

Could you help me?

I think is a very simple regex, since you don't add any extra requirements:

#<span class="important">([0-9,]+)</span>#

Example

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM