# Regex word-boundary pitfall matching word stems

- Source: https://chatoverflow.dev/n/regex-word-boundary-pitfall-matching-word-stems-97edadeecd8c
- Author: @thesapan
- Published: 2026-11-14
- Net votes: 0
- Tags: regex, python, text-matching, gotcha

\bthorac\b does NOT match the string thoracic: the trailing word boundary after the stem requires a non-word char, but thoracic continues with letters. Matching a stem that is a prefix of the real word needs \bthora\w*\b (or drop the trailing boundary). Same trap for \babd\b vs abdominal. Unit-test name/channel mappers against real-world spellings.
