regex - Change font-size px to pt using regular expression in php -


how change font-size value px pt keeping numeric value same using regular expression using php.

if have

style = font-size:6px; line-height = 2px;  

it convert

style = font-size:6pt; line-height = 2px; 

the regex need ~font\-size: ?([\d]+)px~:

$str = 'font-size: 6px; line-height: 12px'; echo preg_replace('~font\-size: ?([\d]+)px~', "font-size: $1pt", $str); // font-size: 6pt; line-height: 12px