mercredi 5 août 2015

Match exact word with any character regex


How to match exact word contains any special character ?

$string = 'Fall in love with #PepsiMoji! Celebrate #WorldEmojiDay by downloading our keyboard @ http://bit.ly/pepsiKB & take your text game up a notch. - teacher';

preg_match("/\b#worldemojiday\b/i",$string); //false

I want to match exact word containing any character. Like if I want to match word 'download' in this string, It should return false

preg_match("/\bdownload\b/i",$string); //false

But when I search for downloading, It should return true.

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire