Accents and UnicodeAccents et Unicode

You saw it on the ranges page: [a-zA-Z] ignores “é”, “ç” and “û”. The same goes for \w, which is exactly [a-zA-Z0-9_]. Both stop at ASCII.

For French this is a real problem: an expression that looks as though it finds every word silently misses a good share of them. Unicode properties solve it:

  • \p{L} → any letter, accents included;
  • \p{Lu} → an uppercase letter;
  • \p{Ll} → a lowercase letter.

To use \p{...}, the u (Unicode) flag has to be on: it is in every exercise in the module, and in the gmu setting recommended for regex101.

ExerciseExercice 16 · one-letter wordsmots d'une lettre intermediateintermédiaire not startedà faire solvedréussi keep tryingà retravailler
Find the one-letter words surrounded by spaces (such as "y", "a" or "à"). The test text stays French: the lesson is about accented letters, so it does not survive translation.
Trouvez les mots d'une seule lettre entourés d'espaces (comme « y », « a » ou « à »).
Test textTexte de test
On y va ensemble. Elle a fini. Il ira à Montréal en mai. J'ai vu 5 pommes.
On y va ensemble. Elle a fini. Il ira à Montréal en mai. J'ai vu 5 pommes.
Expected matches:Correspondances attendues : y a à ␣ space · ⇥ tab · ⏎ line break · ◆ empty match␣ espace · ⇥ tabulation · ⏎ retour à la ligne · ◆ correspondance vide
Expected matches:Correspondances attendues : y a à ␣ space · ⇥ tab · ⏎ line break · ◆ empty match␣ espace · ⇥ tabulation · ⏎ retour à la ligne · ◆ correspondance vide
//gmu
The characters of “Il y a à voir” in a row of boxes; the space-y-space and space-à-space runs are marked as match 1 and match 2, and the “a” between them is marked not found, because the space to its left belongs to match 1
Figure 4. In “Il y a à voir”, the pattern / \p{L} / finds two matches. The “a” is not one of them: the space to its left has already been used.
Written alternately in EN and FR, translation partly generated in both directions. Rédigé en alternance en EN et en FR, traduction en partie générée dans les deux sens. Updated 2026-08-27

Vous l’avez vu dès la page sur les plages : [a-zA-Z] ignore « é », « ç » ou « û ». Il en va de même pour \w, qui est exactement [a-zA-Z0-9_]. Les deux s’arrêtent à l’ASCII.

Pour le français, c’est un vrai problème : une expression qui a l’air de trouver tous les mots en manque silencieusement une bonne partie. Les propriétés Unicode le résolvent :

  • \p{L} → n’importe quelle lettre, accents compris ;
  • \p{Lu} → une lettre majuscule ;
  • \p{Ll} → une lettre minuscule.

Pour utiliser \p{...}, le drapeau u (Unicode) doit être actif : c’est le cas dans tous les exercices du module et dans le réglage gmu recommandé pour regex101.

ExerciseExercice 16 · one-letter wordsmots d'une lettre intermediateintermédiaire not startedà faire solvedréussi keep tryingà retravailler
Find the one-letter words surrounded by spaces (such as "y", "a" or "à"). The test text stays French: the lesson is about accented letters, so it does not survive translation.
Trouvez les mots d'une seule lettre entourés d'espaces (comme « y », « a » ou « à »).
Test textTexte de test
On y va ensemble. Elle a fini. Il ira à Montréal en mai. J'ai vu 5 pommes.
On y va ensemble. Elle a fini. Il ira à Montréal en mai. J'ai vu 5 pommes.
Expected matches:Correspondances attendues : y a à ␣ space · ⇥ tab · ⏎ line break · ◆ empty match␣ espace · ⇥ tabulation · ⏎ retour à la ligne · ◆ correspondance vide
Expected matches:Correspondances attendues : y a à ␣ space · ⇥ tab · ⏎ line break · ◆ empty match␣ espace · ⇥ tabulation · ⏎ retour à la ligne · ◆ correspondance vide
//gmu
Les caractères de « Il y a à voir » dans une rangée de cases ; les suites espace-y-espace et espace-à-espace sont marquées comme correspondance 1 et correspondance 2, et le « a » entre les deux est marqué non trouvé, parce que l'espace à sa gauche appartient à la correspondance 1
Figure 4. Dans « Il y a à voir », le motif / \p{L} / trouve deux correspondances. Le « a » n'en fait pas partie : l'espace à sa gauche a déjà servi.
Written alternately in EN and FR, translation partly generated in both directions. Rédigé en alternance en EN et en FR, traduction en partie générée dans les deux sens. Mise à jour 2026-08-30

Sources

Sources

Spotted an error? Une erreur ?

Language, content, a broken link: tell me what you saw and I will fix it. Langue, contenu, lien brisé : dites-moi ce que vous avez vu et je corrige.

Sending opens your mail app with the report addressed to me. L'envoi ouvre votre application de courriel avec le signalement déjà adressé à moi.