<?php $test = [ 'nexus 7', 'nexus 5', 'nexus 57', ]; foreach($test as $string) { echo preg_replace(['~^(nexus)\s*(7)$~i', '~^(nexus).*+~i'], ['nexus 7', 'nexus'], $string), "\n"; }
You have javascript disabled. You will not be able to edit any code.