I am trying to replace the first occurnce of css size(px|pt|em) with -
so this:
64px 64px #123456
will become:
-64px 64px #123456
I am using the next regex:
preg_replace("/((-*\d+(?:px|e[mx]|%)?)\s(-*\d+(?:px|e[mx]|%)?)){1,1}?/si", "-$1", $input_lines);
it works great when there are only 2 sets of sizes but when there are 4 like:
64px 64px 12px 12px #123456 in get the next results:
-64px 64px -12px 12px #123456.
what can I do to stop it after the first occurrence?
Thanks!
gin preg_replaec @FritsvanCampen : I am parsing css files