in reply to When is a trailing space not a trailing space?

Run your HTML file through od or some other tool that displays the numerical value of each character. My guess (possibly wrong) is that it's the non-breaking space character, which is not matched by \s (and shouldn't be, in my opinion).

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Replies are listed 'Best First'.
Re^2: When is a trailing space not a trailing space?
by markguy (Scribe) on Oct 17, 2005 at 15:03 UTC

    It absolutely shouldn't match if it's not a space character... I've just never had so much trouble *seeing* what the character is and getting rid of it.

    It makes me wonder what else has snuck into tables I've been working with all because the invisible character wasn't at the end where I'm regularly look to clean up.

    In any case, I'll give od a shot... thanks!

      It makes me wonder what else has snuck into tables I've been working with all because the invisible character wasn't at the end where I'm regularly look to clean up.

      Rather than cutting out unwanted characters, you may want to only match what you know to be ok for the entire line. For example, if you want only printable non-whitespace characters, then match only that (see "perldoc perlre" for more details). Also, you may want to warn/die if you find characters in a line that you don't think should be there.