"D. Bolliger" schreef:

> #!/usr/bin/perl
> use strict;
> use warnings;
>
> while (<DATA>) {
>   s/(\d+\s+cm)/<bx;1>$1<ba>/g;
>   print;
> }
>
> __DATA__
> 54 x 34 x 30-3/4 H<l>137 x 86 x 78 cm<l>Kneehole Height: 24-1/2`` (62
> cm)<l>Chair height: 30-3/4 (78 cm)<l>

If "cm" can be wrapped to the next line, either slurp or use paragraph
mode:


#!/usr/bin/perl
  use strict ;
  use warnings ;

  { local $/ = '';  #  paragraph mode
    while (<DATA>)
    {
      s/([0-9]+\s+cm)/<bx;1>$1<ba>/g ;
      print ;
    }
  }

__DATA__
54 x 34 x 30-3/4 H<l>137 x 86 x 78 cm<l>Kneehole Height: 24.5" (62
cm)<l>Chair height: 30-3/4 (78 cm)<l>


In Latin1 (ISO-8859-1) there is a NBSP available.

-- 
Affijn, Ruud

"Gewoon is een tijger."


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to