I have been fiddling with this for almost an hour and am getting nowhere. Regexes are not my strong suit.
I have data like the following:
.cke_button_about .cke_icon { background-position: 0 -76px; }
.cke_button_maximize .cke_icon { background-position: 0 -108px; }
I need to replace the vertical values (-76px and -108px) using preg_replace_callback()
. The callback function is written, but I can't for the life of me get the numbers out properly.
This works fine for 4-digit numbers:
preg_replace_callback("/(background\-position\:)(.*)(\d{4})(px)/", "recalculate",
$css_string);
but how can I make it so it recognizes any kind of number? {1-4} should work but somehow conflicts with the first, horizontal value.
Would anybody like to help me out?
Thanks in advance.