in reply to Re^2: Regex help
in thread Regex help
abcdecgfhas 7 unique letters.
A single regexp would be too convoluted I guess (I say that only because such a regexp is beyond my skills :-) update: or laziness :-)
#!/usr/bin/perl -nl if (length == 8) { $c = substr ($_, 2, 1); if (substr ($_, 5, 1) eq $c) { my %h; @h{split//,$_} = (1) x 8; print if keys %h == 7; } } __END__ perl match.pl /usr/share/dict/words Abednego abscised Acadians Acadia's Acalia's acerbest Adaiha's Adalia's Adelbert ... whirling whisking Wieche's wielders Winton's worker's writhing Yahweh's Yeargain Ygerne's Yorker's Zarger's Ziegfeld
update: changed to -nl to apply on /usr/share/dict/words
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Regex help
by Anonymous Monk on Jun 23, 2007 at 02:13 UTC | |
by shmem (Chancellor) on Jun 23, 2007 at 06:42 UTC | |
by Anonymous Monk on Jun 24, 2007 at 03:03 UTC | |
by shmem (Chancellor) on Jun 24, 2007 at 05:26 UTC |