I am working with regular expressions, and I have this block of code:
$find = "/jsfile\.js?[0-9]*</";
$switch = 'jsfile.js?version=' . $version . '<';
$replace = preg_replace($find, $switch, $data);
My problem is that my JavaScript file now has ?version=<number>
. Now, if I run this script again, it will break.
Is there a way to say, using regular expressions, in my $find
string that ?version=
may or may not be there?