Is it possible to use anchors inside a character class? This doesn\'t work:
analyze-string(\'abcd\', \'[\\s^]abcd[\\s$]\')
It looks like <
Using the caret after the first square bracket will negate the character class. It essentially gives you the opposite of what you're looking to do, meaning the character class will match any character that is not in the character class. Negated character classes also match (invisible) line break characters.
You could try doing a negative look-ahead possibly.
(?!\s)