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
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:
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
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
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:
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
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
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
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
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
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
11 matches
Mail list logo