I want to get the input values in the string. I use two different patterns for this. But the result is the same. What is the reason of this?
$string = 'hello world is .. <input type="text" id="level" value="5"> <input type="text" id="option" value="24"> .. tyhis is example text.';
$pattern = '/<input(?:.*?)id=\"option\"(?:.*)value=\"([^"]+).*>/i';
$pattern2 = '/<input(?:.*?)id=\"level\"(?:.*)value=\"([^"]+).*>/i';
preg_match($pattern, $string, $matches);
preg_match($pattern2, $string, $matches2);
echo $matches[1];
echo "<br>";
echo $matches2[1];
Result:
24
24
What is the reason of this?