Use this online example to test your template:

Above is a screenshot taken from this live example: https://regex101.com/r/cU5lC2/1
Matches any whole word on the command line.
I will use the phpsh interactive shell on Ubuntu 12.10 to demonstrate the PCRE regex engine through a method known as preg_match
Run phpsh, put some content in a variable, match the word.
el@apollo:~/foo$ phpsh php> $content1 = 'badger' php> $content2 = '1234' php> $content3 = '$%^&' php> echo preg_match('(\w+)', $content1); 1 php> echo preg_match('(\w+)', $content2); 1 php> echo preg_match('(\w+)', $content3); 0
The preg_match method used the PCRE engine in PHP to analyze variables: $content1 , $content2 and $content3 with the pattern (\w)+ .
$ content1 and $ content2 contain at least one word, $ content3 does not.
Matches specific words on the command line without slots
el@apollo:~/foo$ phpsh php> $gun1 = 'dart gun'; php> $gun2 = 'fart gun'; php> $gun3 = 'darty gun'; php> $gun4 = 'unicorn gun'; php> echo preg_match('(dart|fart)', $gun1); 1 php> echo preg_match('(dart|fart)', $gun2); 1 php> echo preg_match('(dart|fart)', $gun3); 1 php> echo preg_match('(dart|fart)', $gun4); 0
The variables gun1 and gun2 contain the string dart or fart , which is correct, but gun3 contains darty and still corresponds to this problem. So, in the following example.
Match specific words on the command line with layers:
Word borders can be matched using \b , see 
Regex Visual Image obtained from http://jex.im/regulex and https://github.com/JexCheng/regulex Example:
el@apollo:~/foo$ phpsh php> $gun1 = 'dart gun'; php> $gun2 = 'fart gun'; php> $gun3 = 'darty gun'; php> $gun4 = 'unicorn gun'; php> echo preg_match('(\bdart\b|\bfart\b)', $gun1); 1 php> echo preg_match('(\bdart\b|\bfart\b)', $gun2); 1 php> echo preg_match('(\bdart\b|\bfart\b)', $gun3); 0 php> echo preg_match('(\bdart\b|\bfart\b)', $gun4); 0
\b claims that we have a word boundary, making sure the βdartβ matches, but the βdartyβ is not.