TASdvlper has asked for the wisdom of the Perl Monks concerning the following question:
Thanks to a lot of help here, I'm getting better at regexp, but I have a problem where I'm not even sure where to start.
I want to check a string that contains one or more of the following comma seperated values (in any order): -config,-files,-params,-driverPath,-appPath,-batchPath. I do not want to allow duplicates or the string could match: NONE. So, following are some examples:
Any help would be greatly appreciated.$s = "-config,-files" VALID $s = "-files,-batchPath" VALID $s = "-files,-batch-driverPath" NOT VALID, not comma seperated. $s = "NONE" VALID $s = "NONE,-params" NOT VALID, can not mix [NONE] with other values +. $s = " -config, -files " NOT VALID, spaces not allowed (beginning, m +iddle or end) $s = "-test" NOT VALID, not a valid parameter $s = "-files,-test,-batchPath" NOT VALID, valid parameters mixed wit +h invalid parameters. $s = "-files,files" NOT VALID, same valid listed 2x $s = "-config,-files,-params,-driverPath,-appPath,-batchPath" VALI +D
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regular expression question
by kvale (Monsignor) on Apr 26, 2004 at 16:41 UTC | |
|
Re: Regular expression question
by ccn (Vicar) on Apr 26, 2004 at 16:42 UTC | |
by dave_the_m (Monsignor) on Apr 26, 2004 at 16:59 UTC | |
|
Re: Regular expression question
by japhy (Canon) on Apr 26, 2004 at 17:14 UTC | |
|
Re: Regular expression question
by CountZero (Bishop) on Apr 26, 2004 at 19:25 UTC |