Build, test, and debug regular expressions
This regular expression matches sequences of word characters, optionally matching a single trailing whitespace character, but only if that space is immediately followed by another word character. It uses a capturing group to isolate the word itself while the outer non-capturing group consumes the 'glue' (the space) connecting words. This pattern is useful for tokenizing text where you need to isolate words but also account for the spacing between them.