Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Re: Regex (lookahead) Confusion

by Anonymous Monk
on Feb 05, 2004 at 21:01 UTC ( [id://326879]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://326879]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-19 21:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found