in reply to Re: Regex (lookahead) Confusion
in thread Regex (lookahead) Confusion

Not quite what the OP wanted. It was required that the word was completely made of allowed characters only. Try this:

while (<DATA>) { chomp; if (! /([smtwhfa])(?=.*?\1)/) { print "$_ : OK\n"; } else { print "$_ : Not OK\n"; } } __DATA__ smsa smta stmwhas BADsmtaEXAMPLE

And the output

smsa : Not OK smta : OK stmwhas : Not OK : OK BADsmtaEXAMPLE : OK

Replies are listed 'Best First'.
Re: Re: Re: Regex (lookahead) Confusion
by allolex (Curate) on Feb 05, 2004 at 21:17 UTC

    Except that this appears to be exactly the same code as Roger used.

    --
    Allolex

      True. The point is that he didn't test it with the right data.

      I was saying that his code will give wrong results for the two lines I added, just to prove my assertion.