</li><li class="active"><a href="javascript:;">2</a>
How to extract 2 using regular expression in php?
2 is a variable
世界只因有你2017-05-16 13:17:16
$patt = '/<\/li><li class="active"><a href="javascript:;">(\d+)<\/a>/';
$str = '</li><li class="active"><a href="javascript:;">2</a><li></a>';
preg_match($patt, $str,$arr);
var_dump($arr[1]);
For this thing, you should check how to use it only when you are using it. After all, you don’t use it much.
为情所困2017-05-16 13:17:16
'</li><li class="active"><a href="javascript:;">2</a>'.replace(/.+<li[^>]+class="active"><a[^>]+>(.+)<\/a>/,'$1')