Whitespace charactersLes caractères d'espacement

Whitespace characters include, beyond the regular space between words you type with the space bar, several invisible formatting characters:

  • \ttab (columns, indentation);
  • \nline feed, the line break;
  • \rcarriage return, mostly seen in Windows line endings (\r\n); mentioned for reference;
  • the ordinary space → no abbreviation: you type a space.

They are characters like any other, stored in the file; they are simply invisible on screen, as plain text and its lines shows for the line break. A regular expression finds them the way it finds a letter, which makes it the most direct tool for typographic clean-up: double spaces, trailing spaces at the end of a line, tabs left behind by a copy-paste.

ExerciseExercice 11 · the character before a tabcaractère avant tabulation basicbasique not startedà faire solvedréussi keep tryingà retravailler
Find every character immediately followed by a tab.
Trouvez chaque caractère immédiatement suivi d'une tabulation.
Test textTexte de test
name	surname	age
John	Smith	25
Mary	Martin	30
Ordinary spaces: Peter  Lambert
nom	prenom	age
Jean	Dupont	25
Marie	Martin	30
Espaces normales: Pierre  Lambert
Expected matches:Correspondances attendues : m m n t e n ␣ space · ⇥ tab · ⏎ line break · ◆ empty match␣ espace · ⇥ tabulation · ⏎ retour à la ligne · ◆ correspondance vide
Expected matches:Correspondances attendues : e e n h y n ␣ space · ⇥ tab · ⏎ line break · ◆ empty match␣ espace · ⇥ tabulation · ⏎ retour à la ligne · ◆ correspondance vide
//gmu
ExerciseExercice 12 · line breaksretours à la ligne basicbasique not startedà faire solvedréussi keep tryingà retravailler
Find every line-break character (\n).
Trouvez tous les caractères de retour à la ligne (\n).
Test textTexte de test
First line
Second line
Third line
Fourth line
Première ligne
Deuxième ligne
Troisième ligne
Quatrième ligne
Expected matches:Correspondances attendues : ␣ space · ⇥ tab · ⏎ line break · ◆ empty match␣ espace · ⇥ tabulation · ⏎ retour à la ligne · ◆ correspondance vide
Expected matches:Correspondances attendues : ␣ space · ⇥ tab · ⏎ line break · ◆ empty match␣ espace · ⇥ tabulation · ⏎ retour à la ligne · ◆ correspondance vide
//gmu
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

Les caractères d’espacement (ou blancs) comprennent, au-delà de l’espace ordinaire entre les mots (celle que vous tapez avec la barre d’espacement), plusieurs caractères invisibles de mise en forme :

  • \ttabulation (colonnes, indentation) ;
  • \nsaut de ligne (line feed) ;
  • \rretour chariot, surtout présent dans les fins de ligne Windows (\r\n) ; mentionné pour référence ;
  • l’espace ordinaire → pas d’abréviation : on tape une espace.

Ce sont des caractères comme les autres, enregistrés dans le fichier ; ils sont simplement invisibles à l’écran, ce que la page sur le texte brut et ses lignes montre pour le saut de ligne. Une expression rationnelle les trouve donc de la même façon qu’elle trouve une lettre, ce qui en fait l’outil de nettoyage typographique le plus direct : doubles espaces, espaces en fin de ligne, tabulations laissées par un copier-coller.

ExerciseExercice 11 · the character before a tabcaractère avant tabulation basicbasique not startedà faire solvedréussi keep tryingà retravailler
Find every character immediately followed by a tab.
Trouvez chaque caractère immédiatement suivi d'une tabulation.
Test textTexte de test
name	surname	age
John	Smith	25
Mary	Martin	30
Ordinary spaces: Peter  Lambert
nom	prenom	age
Jean	Dupont	25
Marie	Martin	30
Espaces normales: Pierre  Lambert
Expected matches:Correspondances attendues : m m n t e n ␣ space · ⇥ tab · ⏎ line break · ◆ empty match␣ espace · ⇥ tabulation · ⏎ retour à la ligne · ◆ correspondance vide
Expected matches:Correspondances attendues : e e n h y n ␣ space · ⇥ tab · ⏎ line break · ◆ empty match␣ espace · ⇥ tabulation · ⏎ retour à la ligne · ◆ correspondance vide
//gmu
ExerciseExercice 12 · line breaksretours à la ligne basicbasique not startedà faire solvedréussi keep tryingà retravailler
Find every line-break character (\n).
Trouvez tous les caractères de retour à la ligne (\n).
Test textTexte de test
First line
Second line
Third line
Fourth line
Première ligne
Deuxième ligne
Troisième ligne
Quatrième ligne
Expected matches:Correspondances attendues : ␣ space · ⇥ tab · ⏎ line break · ◆ empty match␣ espace · ⇥ tabulation · ⏎ retour à la ligne · ◆ correspondance vide
Expected matches:Correspondances attendues : ␣ space · ⇥ tab · ⏎ line break · ◆ empty match␣ espace · ⇥ tabulation · ⏎ retour à la ligne · ◆ correspondance vide
//gmu
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.