in reply to Re: Re: 'one-liner' help
in thread 'one-liner' help

Wouldn't <br><br><\sbody> match <br><br></body> since \s matches any non-whitespace?

\s matches whitespace.
\S matches non-whitespace.

Better to quote the backslash, if necessary, to match it explicitly.

Replies are listed 'Best First'.
Re: Re: Re: Re: 'one-liner' help
by buc99 (Initiate) on Apr 16, 2003 at 22:16 UTC
    My bad. i got my \s and \S mixed up. But the script still does not work as stated above.

    Any ideas?

    Thanks.
    SA
    :)
      Any ideas?

      As it happens, yes. Note that   m#</div></div># will not match

      </div> </div>
      because there's (vertical) whitespace between the two tags. You need \s* in your regex at points where whitespace is expected to appear between tags. And you need to slurp the entire file into memory first, since doing this line-by-line won't work.

      I've not tried it, but perlrun notes that -00 will force Perl into "paragraph" mode. Given your HTML, that might be sufficient. Otherwise, investigate the other options in perlrun.