in reply to Re: parsing question
in thread parsing question

Hi Ab, but I have tested the following code, which were giving me the same test results on many test cases:
if ($str =~ /_test(?>\s+)(?!<)/) { print "test ok\n" } if ($str =~ /_test(?:\s+)(?!<)/) { print "test ok\n" }
Could you please tell me as why the /_test(?:\s+)(?!<)/ is wrong? I want to learn. Thanks!

Replies are listed 'Best First'.
Re: parsing question
by Abigail-II (Bishop) on Sep 15, 2003 at 11:36 UTC
    As I said before, it was pointed out elsewhere in this thread. In one of my postings, I showed a program pointing out the differences. Please read the entire thread - it's not that there are 500 postings.

    Abigail

      Thanks Abigail, I have realised the problem of my mistake, where the double space is matched as "space + not <". My previous regular expression should really be written as /_test\s+(?![\s|<])/, as "space not followed by another space or <". Thanks for your help!