Searching for a sub-string inside of string with dashes

I'm trying to search for a partial string in my array using preg_match. I've got it working well enough, but some of the strings in my array have dashes (-) in them and the results aren't coming back as they should. I'm not too familiar with regex to know why.

Here is my preg_match:

if(preg_match("/\b$game\b/i", $value['name']))

If I search for "My Dog", it will give me all the results with the text "My" and "Dog". But any results which have "My-Dog" in them, it won't return them. Is it possible for me also display results if I type "mydog"?


I would add a function to standardize both the test string and the regex string before checking for the match.

function standardize($word){
    $word = strtolower($word);
    $word = str_replace("-", "", $word);
    $word = str_replace(" ", "", $word);
    return $word;

$game = standardize($game);

if(preg_match("/\b$game\b/i", standardize($value['name'])))

What about this regex pattern:

/my[- ]{0,1}dog/i

this will search for 'my' then - or empty space, zero or one time and then dog. The i at the end means case insensitive match.