作者:笃笃声_965 | 来源:互联网 | 2023-01-26 16:50
Howtomatchexactwordcontainsanyspecialcharacter?如何匹配准确的单词包含任何特殊的字符?$stringFallinlov
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
我要匹配包含任何字符的确切单词。就像如果我想匹配这个字符串中的单词“download”一样,它应该返回false
preg_match("/\bdownload\b/i",$string); //false
But when I search for downloading, It should return true.
但是当我搜索下载时,它应该返回true。
Thanks
谢谢
2 个解决方案