How to remove the space after an apostrophe

2025-12-28 Sunday 6h 56 pm

This function is extremely useful to correct texts in French.
You'll find for example l' éleve, with a space after the apostrophe.
Well it's a nono. There should not be a space after the apostrophe. ex: l'élève.
This code corrects the mistake. It works with any letter.

# Sample input string
set input "l' space T' est b' test z' example"

# Use regsub to remove the space after an apostrophe
regsub {([a-zA-Z])'\s} $input {\1'} output

# Print the modified string
puts "Original: $input"
puts "Modified: $output"