in reply to Re: Re: parsing question
in thread parsing question

Considering that /_test(?:\s+)(?!<)/ is wrong, as demonstrated elsewhere in this thread, I fail to see your point.

Abigail

Replies are listed 'Best First'.
Re: Re: parsing question
by Roger (Parson) on Sep 15, 2003 at 09:07 UTC
    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!
      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!