 <p>You could probably use punctuation or word boundry. </p> <p><strong><em>note</em> -</strong> Have to be carefull when specifying something like this <code>\byes\.\b</code><br> on the left hand side is <code>\.</code> a non-word, therefore to match on the right hand side <code>\b</code><br> there needs to be a word <code>\w</code> or it won't match. </p> <p>So, don't do that. </p> <p>This might work. </p> <p><code>\b(yes(?:\p{Punct}|\b))</code> </p> <p>And with a slight modification, you can exclude certain punctuation like this.<br> This captures all non-quote punctuation, that will be deleted as part of the replacement, or just matches a word boundry. </p> <p><code>\b(yes(?:[^\P{Punct}'"]|\b))</code> </p> <p>Another alternative is to include just the punctuation you want. </p> <p><code>\b(yes(?:[.,+*?-]|\b))</code> </p>