I fetched some html with file_get_contents
put it in a string. Now, I am trying to search inside it. I think I should search it using a wildcard but I couldn't make it work.
The html I want to search looks like ">2</td>
and I want to use a wildcard in the number bit.
I think I should use regex but I couldn't figure out how to use it.
My trial looks like:
if (preg_match('/>(\w+)</td>/', $content, $matches)) {
echo $matches[1];
}
How can I add character limit of 1 to the regex, so I search only up to 3 characters long and only form of integer for the wildcard?
Or is there any better way other than regex; for looking for that html strings and put them inside an array?