What potential issues or limitations should be considered when using regular expressions in PHP to extract data?

One potential issue when using regular expressions in PHP to extract data is the possibility of the pattern not matching the input data accurately, leading to incorrect results or no matches at all. To address this, it is important to thoroughly test the regular expression pattern with various input data to ensure its accuracy.

$input_data = "The price is $100";
$pattern = '/\$[0-9]+/';

if (preg_match($pattern, $input_data, $matches)) {
    echo "Match found: " . $matches[0];
} else {
    echo "No match found";
}