problem with split
hanumizzle at gmail.com
Sat Oct 7 07:55:59 CEST 2006
On 10/7/06, goyatlah <goyatlah> wrote:
> Think you need a regex like this: regex =
[0-9] maybe written simply as \d (d for digit)
> import re
> test = re.compile(regex)
Regexes are usually passed as literals directly to re.compile().
> testing is done as follows:
> res = test.match(mystring)
Initial \s* is redundant if you use the search() method.
> if res:
I forgot that part. :)
> number = res.group(1) # always a string consisting of decimals
> comment = res.group(2) # string starting with ; or None
> it might be necessary to have the instr part of the regex as follows
> [iI][nN][sS][tT][rR] to handle things like Instr or INSTR.
It is sufficient to use the re.IGNORECASE flag.
More information about the Python-list