regex in python

2006-05-25 Thread gisleyt
I'm trying to compile a perfectly valid regex, but get the error message: r = re.compile(r'([^\d]*)(\d{1,3}\.\d{0,2})?(\d*)(\,\d{1,3}\.\d{0,2})?(\d*)?.*') Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.3/sre.py", line 179, in compile return _compile(patter

Index counting from the last char

2006-05-22 Thread gisleyt
I'd like to use the index-function to retrieve a certain char in a string, but i need it to start counting from the last char. E.g. in the string. Foo-bar, foo foo-bar I want the latter hyphen to be returned when i do a index for '-'. Is there any built in function for this, I don't want to reve