0

I have build myself an Regular expression, which works absolutely fine when tried on various RegEx testing Websites, but now im trying to implement this into an PHP Script, and its constantly throwing errors.

I tried this:

$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

I also tried

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

Can someone maybe explain me what to do?

My pattern is:

<span\ id="current\-followers\-value"\ class="profile\-info\-content">(\d*)</span>

Test String:

<span id="current-followers-value" class="profile-info-content">142</span>
Altay Akkus
  • 325
  • 1
  • 10
  • isn't the slash in `` treated as end of the expression? – Matey Dec 15 '17 at 18:14
  • Use different delimiters [as suggested here](https://stackoverflow.com/a/22816067/3832970), or escape `/` in the pattern. – Wiktor Stribiżew Dec 15 '17 at 18:14
  • FYI wrt your now delete meta question: you might find [this](https://meta.stackexchange.com/questions/10369/which-tools-and-technologies-are-used-to-build-the-stack-exchange-network) handy. – rene Dec 31 '17 at 00:14

0 Answers0