0

如果我有一个很大的 html 文本,我需要从中提取特定的句子,例如“/user/abdullaheidtv/videos?sort=dd&view=0&page=1”

也许我需要的是 "/user/abdullaheidtv/videos?sort=dd&view=0&page= 12 " 或 "/user/abdullaheidtv/videos?sort=dd&view=0&page= 50 " 或 "/user/abdullaheidtv/videos?sort=dd&view =0&页= 90 "

我想提取任何包含“/user/abdullaheidtv/videos?sort=dd&view=0&page= $no

只有最后一个数字是变量

等待帮助:)

4

1 回答 1

0

Regex can help you there. Use preg_match.

@/user/abdullaheidtv/videos\?sort=dd\&view=\d+\&page=\d+@

should match.

Note, I'm using @...@ for the regular expression so that I don't need to escape / every time.

HTH.

于 2012-05-17T03:54:03.057 回答