re grouping question
Michael Esveldt
dante at oz.net
Thu May 3 21:44:50 EDT 2001
I've got the following code:
s = """some text
- foo
- bar
- fnord
test..."""
list_re = re.compile(r'( - .+\n)+')
print list_re.search(s).groups()
which produces, (' - fnord\n',) when what I was expecting was matching
all the lines. What I'm really looking for is something more like (' -
foo\n - bar\n - fnord\n',) or (even better) (' - foo\n', ' - bar\n', ' -
fnord\n').
I tried this in perl and got the same results, in tcl it matches what I
want, but who knows about tcl.
Thanks,
Michael
--
The Chao says Mu.
Michael Esveldt, #FightThePower on irc.openprojects.net
<mailto:dante at oz.net> <http://velocity.editthispage.com/>
More information about the Python-list
mailing list