preg_replace regex for removing product sizes from string
I would like to remove a size from titles i.e.
Shift Fuel Street Motorcycle Riding Shoes Size 10
to become
Shift Fuel Street Motorcycle Riding Shoes
so far I have regex to remove grams, centimeters etc. but those are a bit different as digit there are before string, so the pattern for those is:
preg_replace('/(?<!\S)(\b|\(|\[)?\d+(?:\.\d+)?\s*cm($|\s|\.|;|,|\)|\])/is', '${1}${2}', $string);
Can you help with modifying pattern above so can work with sizes as in example at the top 开发者_如何转开发of this post/question?
many thanks
Removing the size:
preg_replace("/\s+Size\s+\d+/", '', $text);
UPDATE to support "Size: 10":
preg_replace("/\s+Size:?\s+\d+/", '', $text);
精彩评论