\b and accented letters\b et les lettres accentuées
The accents page showed how
you can overcome the limitations of \w by using \p{L} instead, which does
include accented letters. \b has no such way out: it stays defined by \w
whether or not the u flag is on, and there is no Unicode property to put in
its place.
The consequence is concrete, and easier to see than to explain. Since “é” is not a word character, there is no boundary between a space and an “é”, so no start of word is found in front of “été”. And since there IS a boundary between “è” (not a word character) and “s” (a word character), one is found in the middle of “très”.
\b and \p{L}, then compare the matches with what you expected: which ones are missing, and why? The test text stays French, because the lesson is what \b does to accented letters.\b et \p{L}, puis comparez les correspondances à ce que vous attendiez : lesquels manquent, et pourquoi ?Il a été très fier. Son thé est là. Elle dit que non. Le mot 'car' aussi.Il a été très fier. Son thé est là. Elle dit que non. Le mot 'car' aussi. trè Son est dit que non mot car trè Son est dit que non mot car La page sur les accents a
montré comment contourner les limites de \w en utilisant \p{L}, qui inclut
les lettres accentuées. Le \b, lui, n’a pas d’échappatoire : il reste défini
par \w, que le drapeau u soit actif ou non, et il n’existe aucune propriété
Unicode pour le remplacer.
La conséquence est concrète, et elle se voit mieux qu’elle ne s’explique. Comme « é » n’est pas un caractère de mot, il n’y a pas de limite entre une espace et un « é » : aucun début de mot n’est trouvé devant « été ». Et comme il y a bien une limite entre « è » (non-mot) et « s » (mot), il s’en trouve une au milieu de « très ».
\b and \p{L}, then compare the matches with what you expected: which ones are missing, and why? The test text stays French, because the lesson is what \b does to accented letters.\b et \p{L}, puis comparez les correspondances à ce que vous attendiez : lesquels manquent, et pourquoi ?Il a été très fier. Son thé est là. Elle dit que non. Le mot 'car' aussi.Il a été très fier. Son thé est là. Elle dit que non. Le mot 'car' aussi. trè Son est dit que non mot car trè Son est dit que non mot car Sources
- MDN Web Docs (n.d.). Regular expressions. MDN JavaScript Guide, Mozilla. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions
- Jurafsky, D., & Martin, J. H. (2026). Speech and Language Processing: An Introduction to Natural Language Processing, Computational Linguistics, and Speech Recognition with Language Models. Online draft, 3rd edition. https://web.stanford.edu/~jurafsky/slp3/
Sources
- MDN Web Docs (n.d.). Regular expressions. MDN JavaScript Guide, Mozilla. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions
- Jurafsky, D., & Martin, J. H. (2026). Speech and Language Processing: An Introduction to Natural Language Processing, Computational Linguistics, and Speech Recognition with Language Models. Online draft, 3rd edition. https://web.stanford.edu/~jurafsky/slp3/