Been trying to figure this one out and it's stumped me.
Trying to find a regex that will match 'word' but only if there is either a space, nothing, or punctuation on either side.
So, if the word was cat:
"cat" matches
" cat" matches
" cat? " matches
"scatting" doesn't match
I tried "[^a-zA-Z0-9] $+ %word $+ [^a-zA-Z0-9]" but that still demands a space either side. I know it sounds simple, but I can't figure it out. Any help will be appreciated. Thanks!