in reply to REGEX different on Linux & Win32!

I tested your snipet on Mandrake 9 without a problem. Most likely the problem is caused by something in your data. I would encourage you to post a sample of the actual data here.

One thing that might help you if you are parsing HTML would be to look into HTML::TokeParser on CPAN. It can recognize those CODE sections as well., Update: see tachyon's post below

Hope that helps
Chris

Lobster Aliens Are attacking the world!

Replies are listed 'Best First'.
Re: Re: REGEX different on Linux & Win32!
by tachyon (Chancellor) on Feb 24, 2003 at 23:24 UTC

    It can recognize those CODE sections as well.

    Actually, good though HTML::TokeParser is it does not recognise them

    $data = q` HTML1 <% CODE1 %> HTML2 <% CODE2 %> HTML3 <p>foo</p> `; use Data::Dumper; use HTML::TokeParser; my $parser = HTML::TokeParser->new( \$data ); while ( my $token = $parser->get_token() ) { print Dumper($token) if $token->[1] =~ m/<%/; } __DATA__ $VAR1 = [ 'T', '<% CODE1 %> HTML2 ', '' ]; $VAR1 = [ 'T', '<% CODE2 %> HTML3 ', '' ];

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

      Opps, I assumed since it recognizes <? and  ?> that it would do  <% style as well. That's what I get for assuming! Though I would consider that a bug of HTML::TokeParser.

      Lobster Aliens Are attacking the world!
        I would not. <% doesn't mean anything special in HTML, it's just a less than sign followed by a percent sign. Since it's not an HTML token, I'd consider it a bug if HTML::TokeParser would consider it a token.

        Abigail

A reply falls below the community's threshold of quality. You may see it by logging in.