regex matching question

2007-05-19 Thread bullockbefriending bard
first, regex part: I am new to regexes and have come up with the following expression: ((1[0-4]|[1-9]),(1[0-4]|[1-9])/){5}(1[0-4]|[1-9]),(1[0-4]|[1-9]) to exactly match strings which look like this: 1,2/3,4/5,6/7,8/9,10/11,12 i.e. 6 comma-delimited pairs of integer numbers separated

Re: regex matching question

2007-05-19 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], bullockbefriending bard wrote: first, regex part: I am new to regexes and have come up with the following expression: ((1[0-4]|[1-9]),(1[0-4]|[1-9])/){5}(1[0-4]|[1-9]),(1[0-4]|[1-9]) to exactly match strings which look like this:

Re: regex matching question

2007-05-19 Thread bullockbefriending bard
thanks for your suggestion. i had already implemented the all pairs different constraint in python code. even though i don't really need to give very explicit error messages about what might be wrong with my data (obviously easier to do if do all constraint validation in code rather than one

Re: regex matching question

2007-05-19 Thread Gabriel Genellina
En Sat, 19 May 2007 19:40:39 -0300, bullockbefriending bard [EMAIL PROTECTED] escribió: from my cursory skimming of friedl, i get the feeling that the all pairs different constraint would give rise to some kind of fairly baroque expression, perhaps likely to bring to mind the following

Re: regex matching question

2007-05-19 Thread John Machin
On 20/05/2007 3:21 AM, bullockbefriending bard wrote: first, regex part: I am new to regexes and have come up with the following expression: ((1[0-4]|[1-9]),(1[0-4]|[1-9])/){5}(1[0-4]|[1-9]),(1[0-4]|[1-9]) to exactly match strings which look like this:

Re: regex matching question

2007-05-19 Thread bullockbefriending bard
Backslash? Your example uses a [forward] slash. correct.. my mistake. i use forward slashes. Are you sure you don't want to allow for some spaces in the data, for the benefit of the humans, e.g. 1,2 / 3,4 / 5,6 / 7,8 / 9,10 / 11,12 you are correct. however, i am using string as a

Re: regex matching question

2007-05-19 Thread bullockbefriending bard
Instead of the or match.group(0) != results caper, put \Z (*not* $) at the end of your pattern: mobj = re.match(rpattern\Z, results) if not mobj: as the string i am matching against is coming from a command line argument to a script, is there any reason why i cannot get away with just

Re: regex matching question

2007-05-19 Thread bullockbefriending bard
Here all pairs different means for each pair, both numbers must be different, but they may appear in another pair. That is, won't flag 1,2/3,4/3,5/2,6/8,3/1,2 as invalid, but this wasn't clear from your original post. -- Gabriel Genellina thanks! you are correct that the 'all pairs

Re: regex matching question

2007-05-19 Thread John Machin
On 20/05/2007 10:18 AM, bullockbefriending bard wrote: Instead of the or match.group(0) != results caper, put \Z (*not* $) at the end of your pattern: mobj = re.match(rpattern\Z, results) if not mobj: as the string i am matching against is coming from a command line argument to a

Re: regex matching question

2007-05-19 Thread Steve Holden
John Machin wrote: On 20/05/2007 10:18 AM, bullockbefriending bard wrote: Instead of the or match.group(0) != results caper, put \Z (*not* $) at the end of your pattern: mobj = re.match(rpattern\Z, results) if not mobj: as the string i am matching against is coming from a command

Re: regex matching question

2007-05-19 Thread bullockbefriending bard
No way? Famous last words :-) C:\junktype showargs.py import sys; print sys.argv C:\junk\python25\python Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import subprocess