I’m using preg_match to try and capture the ‘Data’ in this html structure but currently it’s not returning anything, I think this may be down to the whitespace?
Just wondering what’s wrong in the preg_match?
html
<td><strong>Title</strong></td>
<td>Data</td>
php
preg_match("~<td><strong>Title</strong></td>
<td>([a-zA-Z0-9 -_]+)</td>~", $html, $match);
Instead of trying to reproduce the exact sequence of whitespace (which may be hard or even impossible due to line endings), just use
\s*to indicate “any number (including zero) of whitespace characters” – this includes spaces, tabs, newlines, carriage returns… exactly what you need here.