douzhi1919 2011-08-07 13:45
浏览 12
已采纳

preg_match php问题

i try to find a Link i a page

Link looks like this

https://pos.xxxxxxxxxx.de/xxxxxxxxxxxx/app?funnel=login_box&tid=2001004

i hide the domain :)

So there is my code:

preg_match('~(https://pos.xxxxxxxxxx.de/xxxxxxxxxx/app\?funnel=login_box&tid=\d+)~', $text, $ans);

nothing found...

i try this one

preg_match('~(https://pos.xxxxxxxxxx.de/xxxxxxxxxx/app\?funnel=login_box&tid=)~', $text, $ans);

try to find only the fixed part of the link...

stil nothing

so i try this one

preg_match('~(https://pos.xxxxxxxxxx.de/xxxxxxxxxx/app\?funnel=login_box)~', $text, $ans);

now i find some links, but why i can't find the whole link???

  • 写回答

3条回答 默认 最新

  • dongsi4815 2011-08-07 13:48
    关注

    Probably in html source, & is expanded to &, try:

    &(amp;)?
    

    Just reminder - . means every char, so you should escape it, but it's not important here.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法