Re: OpenRTS - new OSS Python game
Hello Sybren, To be honest, it looks very much like games from 1995... You should notice: It's a first alpha version. Freundliche Grüße, Christoph -- http://mail.python.org/mailman/listinfo/python-list
Re: Match First Sequence in Regular Expression?
Hello Roger, I'm looking for a regular expression that matches the first, and only the first, sequence of the letter 'a', and only if the length of the sequence is exactly 3. import sys, re, os if __name__=='__main__': m = re.search('a{3}', 'xyz123aaabbaaaabaaabb') print m.group(0) print Preceded by: \ + m.string[0:m.start(0)] + \ Best wishes, Christoph -- http://mail.python.org/mailman/listinfo/python-list
Re: Match First Sequence in Regular Expression?
Hello Roger, since the length of the first sequence of the letter 'a' is 2. Yours accepts it, right? Yes, i misunderstood your requirements. So it must be modified essentially to that what Tim Chase wrote: m = re.search('^[^a]*a{3}b', 'xyz123aabbaaab') Best wishes from germany, Christoph -- http://mail.python.org/mailman/listinfo/python-list
Re: Match First Sequence in Regular Expression?
Hallo Alex, r = re.compile([^a]*a{3}b+(a+b*)*) matches = [s for s in listOfStringsToTest if r.match(s)] Unfortunately, the OP's spec is even more complex than this, if we are to take to the letter what you just quoted; e.g. aazaaab SHOULD match, Then it's again a{3}b, isn't it? Freundliche Grüße, Christoph -- http://mail.python.org/mailman/listinfo/python-list