This is my regular expression:
$pattern_new="/<td>(
|\s)*?(<span(
|\s|.)*?<\/strong>(
|\s)*?\$(?<price>([0-9.]*)).*?)\$(.*?)(
|\s)*?</";
This is the sample pattern from which I have to do a match:
<td><strong>.zx</strong></td><td><span class="offer"><strong>xscre:<br></strong>$299 xxxxx&x;xx<span class="fineprint_number">2</span></span><br>de&ea;s $399</td><td>zxcddcdcdcdc</td></tr><tr class="dark"><td><strong>.aa.rr</strong></td><td><span class="offer"><strong>xscre:<br></strong>$99 xxxxx&x;xx<span class="fineprint_number">2</span></span><br>de&eae;s $199</td><td>xxxx</td></tr><tr class="bar"><td colspan="3"></td></tr><tr class="bright"><td><strong>.vfd</strong></td><td><span class="offer"><strong>xscre:<br></strong>$99 xxxxx&x;xx<span class="fineprint_number">2</span></span><br>duⅇs $199</td><td>xxxxxxxx</td></tr><tr class="dark"><td><strong>.qwe</strong></td><td><span class="offer"><strong>xxx<br></strong>$99 xxxc;o<span class="fineprint_number">2</span>
Here is what I am doing in PHP
$pattern_new="/<td>(
|\s)*?(<span(
|\s|.)*?<\/strong>(
|\s)*?\$(<price>)*([0-9.]*).*?)\$(.*?)(
|\s)*?</";
$source = file_get_contents("https://www.abc.com/sources/data.txt");
preg_match_all($pattern_new, $source, $match_newprice, PREG_PATTERN_ORDER);
echo$source;
print_r($match_newprice);
the$match_newprice
is returning an empty array.
When I am using a regex tester like myregextester or solmetra.com I am getting a perfect match no issues at all but when I am using php preg_match_all
to do the match it is returning an empty array. I increased the pcre.backtrack_limit but its still the same issue.
I don't seem to understand the problem. Any help would be much appreciated.