我已经构建了一个正则表达式,当在各种RegEx测试网站上尝试时,它非常好用, 但现在我试图将其实现为PHP脚本,并且不断抛出错误。
我试过了:
$pattern1 = preg_quote('/<span\ id="current\-followers\-value"\ class="profile\-info\-content">(\d*)</span>/');
preg_match($pattern1,$request,$followercount);
Warning: preg_match(): Delimiter must not be alphanumeric or backslash in C:\xampp\htdocs\instagram\getuserinfo.php on line 11
我也试过
preg_match('/<span\ id="current\-followers\-value"\ class="profile\-info\-content">(\d*)</span>/',$request,$followercount);
Warning: preg_match(): Unknown modifier 'p' in C:\xampp\htdocs\instagram\getuserinfo.php on line 10
有人可以解释一下该做什么吗?
我的模式是:
<span\ id="current\-followers\-value"\ class="profile\-info\-content">(\d*)</span>
测试字符串:
<span id="current-followers-value" class="profile-info-content">142</span>