`How to pull out the regular size?
J
J
jle349252015-01-03 17:02:10
PHP
jle34925, 2015-01-03 17:02:10

How to pull out the regular size?

There is a text

`                128 kbps <span class="brSpacer">/</span> 4:40 <span class="brSpacer">/</span> 4.27 mb            `

what regular expression to pull out 4.27??

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman Kitaev, 2015-01-03
@jle34925

/\d+\.\d+/

R
Robot, 2015-01-03
@iam_not_a_robot

Well in this case

preg_match("/span>(.*?)mb/ism", $source, $res);
$size = $res[1];

Your code should be in the $source variable, the final number can be in $res[0] also look (I always confuse them in preg_match)

B
Boris Yakushev, 2015-01-03
@za4me

Course of articles on regular expressions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question