Question: I'm trying to strip the span tags w/ a letter-spacing that starts with 0. or 1.

```
'<span style="letter-spacing:0.50 px">Boulevard,</span> '
to equal
'Boulevard, '

```

Thank you

Here's an example of a complete line.

```
<span style="letter-spacing:1.33 px">PRODUCTS</span> <span style="letter-spacing:1.37 px">MODEL</span> <span style="letter-spacing:0.77 px">HPI-27C</span> <span style="letter-spacing:1.39 px">MODDED)</span> ; <span style="letter-spacing:1.12 px">(HIGHWAY</span> <span style="letter-spacing:1.33 px">PRODUCTS</span> <span style="letter-spacing:1.37 px">MODEL</span>

```

Needs to end up like

PRODUCTS MODEL HPI-27C MODDED) ; (HIGHWAY PRODUCTS MODEL

Answer: 
Here is an example using Perl and [`HTML::Parser`](https://metacpan.org/pod/HTML::Parser) :

```
use strict;
use warnings;
use HTML::Parser ();
my $delete_tag = 0;

my $p = HTML::Parser->new(
    api_version => 3,
    default_h => [sub { print shift }, 'text'],
    start_h => [\&start_handler, 'tagname,text,attr'],
    end_h => [\&end_handler, 'tagname,text'],    
);

my $str = do { local $/; <DATA> };
$p->parse($str) || die $!;
print "\n";

sub end_handler {
    my ( $tag, $text ) = @_;
    if ( $tag eq "span" ) {
        if ($delete_tag) {
            $delete_tag = 0;
            return;
        }
    }
    print $text;
}

sub start_handler {
    my ( $tag, $text, $attr ) = @_;
    if ( $tag eq "span" ) {
        if ($attr->{style} =~ /letter-spacing:[01]\./) {
            $delete_tag = 1;
            return;
        }
    }
    print $text;
}

__DATA__
<span style="letter-spacing:1.33 px">PRODUCTS</span> <span style="letter-spacing:1.37 px">MODEL</span> <span style="letter-spacing:0.77 px">HPI-27C</span> <span style="letter-spacing:1.39 px">MODDED)</span> ; <span style="letter-spacing:1.12 px">(HIGHWAY</span> <span style="letter-spacing:1.33 px">PRODUCTS</span> <span style="letter-spacing:1.37 px">MODEL</span>

```

**Output**:

```
PRODUCTS MODEL HPI-27C MODDED) ; (HIGHWAY PRODUCTS MODEL

```
Not exactly robust but does what you asked for given that 1 sample line you posted:

```
$ sed -E 's#<span[^>]+letter-spacing:[01][^>]+>(.*)</span>#\1#' file
'Boulevard, '

```

The above will work in any sed that supports `-E` for EREs, e.g. GNU sed and OSX sed.

Given your updated sample input/output, this will do what you want with GNU awk for multi-char RS and RT:

```
$ awk -v RS='</span>' '{ORS=( sub(/<span[^>]+letter-spacing:[01][^>]+>/,"") ? "" : RT)}1' file
PRODUCTS MODEL HPI-27C MODDED) ; (HIGHWAY PRODUCTS MODEL

```