PHP preg匹配所有
但我只想要数字 无以下结果:PHP preg匹配所有,php,regex,preg-match-all,Php,Regex,Preg Match All,但我只想要数字 无以下结果: preg_match_all('/\'keep.php\?casuser=(.*) style=\"color:#ffca3e/iU', $result, $matches2); $matches2[1][0] = 400000018623110'); return false;" 有人能帮我吗?解释一下为什么它不起作用? thx有点被这个问题搞糊涂了——如果我有代表的话,我会把它放在评论里 这是否足够 preg_match_all('/\'keep.php\?c
preg_match_all('/\'keep.php\?casuser=(.*) style=\"color:#ffca3e/iU', $result, $matches2);
$matches2[1][0] = 400000018623110'); return false;"
有人能帮我吗?解释一下为什么它不起作用?
thx有点被这个问题搞糊涂了——如果我有代表的话,我会把它放在评论里 这是否足够
preg_match_all('/\'keep.php\?casuser=(.*)\'\); return false;" style=\"color:#ffca3e/iU', $result, $matches2);
或者他们也有相关的风格是重要的吗?如果是,请尝试:
preg_match_all('/\'keep.php\?casuser=(\d*)/i', $result, $matches2);
thx ye style是相关的,非常感谢第二个答案对我有用:)关于为什么你的答案不起作用:第一个匹配casuser=和[space]style=之间的所有字符,第二个匹配casuser=和下一个单引号之间的所有字符,我希望返回400000018623110“onclick=”ajaxLinkSend(',但无论哪种方式都不正确。很高兴能提供帮助。不,我从\'开始,因为我只想要第二个号码:),但我仍然不明白为什么我的第二次尝试不起作用
preg_match_all('/\'keep.php\?casuser=(\d*)/i', $result, $matches2);
preg_match_all('/\'keep.php\?casuser=(\d*).*?style=\"color:#ffca3e/i', $result, $matches2);