in reply to A Regex for no-break space Unicode Entities
(updated to remove incorrect use of "g" modifier on tr///)#!/usr/bin/perl -w use warnings; use strict; binmode(STDIN,":utf8"); binmode(STDOUT,":utf8"); while(<>) { # if you just want to get rid of non-breaking spaces, do this: tr/\xA0/ /; # if you really want to change every kind of whitespace and every stri +ng # of two or more whitespace to a single space, do this instead: s/\s+/ /g; # in utf8 strings, \s matches non-breaking space s/ $/\n/; # (puts back the \n at the end of the line) print; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: A Regex for no-break space Unicode Entities
by kettle (Beadle) on Sep 13, 2006 at 13:40 UTC | |
by graff (Chancellor) on Sep 13, 2006 at 23:43 UTC |