artist has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I like to create a regexp for a number that matches given condition and combine such multiple regex.
Numbers are formed in similar way to MasterMind like game.
Example Number: 1122. Conditions:Total 2 digits in correct place and 1 other digit in wrong place. So once we form the regexp and try to match other numbers, then we can deduce that 1232 is ok, but 2211 is not. I also like to get the next regexp for 3456:1:2 ( Number:3456, CorrectPlace:1, Wrong Place:2) etc and combined with previously obtained regexp(s).
I am not sure, how to start.
Thanks,
Example Number: 1122. Conditions:Total 2 digits in correct place and 1 other digit in wrong place. So once we form the regexp and try to match other numbers, then we can deduce that 1232 is ok, but 2211 is not. I also like to get the next regexp for 3456:1:2 ( Number:3456, CorrectPlace:1, Wrong Place:2) etc and combined with previously obtained regexp(s).
I am not sure, how to start.
Thanks,
--Artist
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Regexp Creation
by jettero (Monsignor) on Jan 25, 2008 at 19:04 UTC | |
Re: Regexp Creation
by kyle (Abbot) on Jan 25, 2008 at 19:04 UTC | |
by artist (Parson) on Jan 25, 2008 at 19:12 UTC | |
by Not_a_Number (Prior) on Jan 25, 2008 at 20:19 UTC | |
Re: Regexp Creation
by toolic (Bishop) on Jan 25, 2008 at 19:09 UTC | |
by artist (Parson) on Jan 25, 2008 at 19:56 UTC |
Back to
Seekers of Perl Wisdom