I've a word, $my_word="MYWORD";
Now, I want to make a regular expression of that, which detects the following cases
--> MY WORD
--> MYWORDS
--> MYWORDSISMINE
--> WORD
--> WORDS
Now, I want to make a regular expression in php using preg_match()
which detects the following occurrences.
My Try:
$mycase = str_replace(' ', '|', $my_word); // where $str would be MYWORD
$mycase = (preg_match("/\b(".$mycase.")\b/", $someFuzzyWord)); // $someFuzzyWord is the user entered string which needs to be filter
I had putted the |
so that it can detect every word and also tried .*
after starting and trailing of a word so that it can be detect a substring.