in reply to Re: Regex (lookahead) Confusion
in thread Regex (lookahead) Confusion
You are *so* the monk!
The regex works because if the variable ength of the space (0-full line) before matching the backreference. And lookaheads can be variable length.
This is essentially the converse approach to what I was thinking trying to solve the problem. Someday...
while (<DATA>) { chomp; if ( /^(?:([smtwhfa])(?!.*\1))*$/ ) { print "$_ : OK\n"; } else { print "$_ : Not OK\n"; } } __DATA__ swma smqa smsa fhtm ttma t2ms __END__ swma : OK smqa : Not OK smsa : Not OK fhtm : OK ttma : Not OK t2ms : Not OK
--
Allolex
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Regex (lookahead) Confusion
by ChrisR (Hermit) on Feb 05, 2004 at 22:01 UTC | |
by allolex (Curate) on Feb 05, 2004 at 22:10 UTC |