开发者

preg_replace pattern for inches replacement PHP with word boundry

开发者 https://www.devze.com 2023-03-09 03:01 出处:网络
I would like to replace something like: Remo Suede Emperor Drumhead 12\" or Remo Suede Emperor 12\" Drumhead

I would like to replace something like:

Remo Suede Emperor Drumhead 12" or
Remo Suede Emperor 12" Drumhead

on

Remo Suede Emperor Drumhead 12inch or
Remo Suede Emperor 12inch Drumhead

Do you know what pattern would be best for preg_replace function ?

P.S. would be good to have a word boundry in there too to avoid false positivies replacamenet i开发者_开发技巧e.

123M90"


$string = preg_replace('/([0-9])"/', '$1inch', $string);
0

精彩评论

暂无评论...
验证码 换一张
取 消