0

我有以下 PHP 正则表达式:

@<tr[\s\S]*?<a class="b1"[\s\S]*?<em[^>]*>([^<]*)[\s\S]*?stars_small_([0-9].[0-9])@

我在这个网站上使用的:

游戏间谍

我得到了这个数据:

[1] => Array
        (
            [0] => AC/DC Live: Rock Band Track Pack
            [1] => Ace Combat 6: Fires of Liberation
            [2] => All-Pro Football 2K8
            [3] => Alone in the Dark
            [4] => Armored Core 4
            [5] => Army of Two
            [6] => Army of Two: The 40th Day
        )

    [2] => Array
        (
            [0] => 3.5
            [1] => 2.5
            [2] => 3.5
            [3] => 3.5
            [4] => 2.5
            [5] => 3.5
            [6] => 3.5
        )

这就是我正在寻找的,但是我似乎并没有取回所有数据。我应该得到以下带有分数的标题。但由于某种原因,我只得到了其中的一些。

AC/DC Live: Rock Band Track Pack     
Ace Combat 6: Fires of Liberation    
Afro Samurai         
Alan Wake    
Aliens vs. Predator  
All-Pro Football 2K8    
Alone in the Dark   
Amped 3     
Armored Core 4  
Army of Two 
Army of Two: The 40th Day   
Assassin's Creed     
Assassin's Creed II  
Assassin's Creed: Brotherhood    
Avatar: The Game

我在这里测试了我的正则表达式:

http://www.solmetra.com/scripts/regex/index.php

使用这个 HTML:

http://justpaste.it/20u5

任何帮助解释为什么我只取回一些结果将不胜感激。谢谢

4

1 回答 1

1

将子模式更改为stars_small_([0-9].[0-9]),因为某些 url 在标签的属性中stars_small_([0-9](?:\.[0-9])?)只有一位数字。SRCIMG

于 2013-02-19T20:43:48.487 回答