in reply to Regex help
I'm trying to match an 8-character word comprising small letters that has the pattern:
Small letters? do you mean small as in low ASCII code or lowercase?
ABCDECFG
Well, /[A-G]{8}/ should yield true.
The only symbol (letter) that is used twice in the word is "C", which is found only in positions 3 and 6.
That is true for the word you presented. Now what? ... guessing ... maybe you want
? that would mach 'corporal' successfully. But then, it has two 'o'. Should that fail then?$c = substr($_,2,1); $pat = "\[^$c\]{2}$c\[^$c\]{2}$c\[^$c\]{2}"; print "yup" if /$pat/
Try again giving us a spec.
--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^2: Regex help
by Anonymous Monk on Jun 22, 2007 at 15:05 UTC | |
by shmem (Chancellor) on Jun 22, 2007 at 15:22 UTC | |
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 blazar (Canon) on Jun 22, 2007 at 17:57 UTC |