[Solved] Find pattern in Html using regex [closed]


try this:

preg_match_all("/(<span>\d{4}<\/span>)/", $myinput, $myoutput);

http://3v4l.org/72ClO

please note this does not parse html. it looks for something that starts with <span> then has 4 digits, then </span>. A single space in there, and will fail.

use this one to get the 4 digits only

preg_match_all("/<span>(\d{4})<\/span>/", $myinput, $myoutput);

http://3v4l.org/FF4Y9

solved Find pattern in Html using regex [closed]