You missed the little + I added to the regex. :-) Using for as expression modificator wasn't the point. The + will cause the regex to delete sequences of whitespace in one fell swoop, rather than character by character.
tr is better in that it doesn't fire up the entire regex engine to do its job. It's therefor more efficient for the specific job of deleting all of a list of characters from a string. However, it doesn't understand classes like \s as the regex engine does, so you have to spell out all the characters. Doing so with hex codes is merely one choice out of several.
Makeshifts last the longest.
|