regex - Regular expression to find word with in word in php -
the below php regular look match string contain gb:2 , word samsung there in 3 word.
but info contain gb-2 or gb,3 etc. want alter regular look gb* take character , alphabet after gb.
how can set gb* in regular expression?
$regex = "~(?i)\bgb:2 (?:\w+\s+){1,3}samsung\b~";
i think you're looking - http://regex101.com/r/qj9dv0
(?i)([0-9]gb|gb)[!@#$%^&*() _,.:-]\w+ (?:\w+\s+){1,3}application edit have remove boundaries , little more literal in selection. have made improvement gb preceeded numbers or gb - http://regex101.com/r/jh7rh0 (you need add together dash special characters grouping noticed in text. has been correctly added in answer.)
php regex
No comments:
Post a Comment