[Tutor] Regex help
Kent Johnson
kent37 at tds.net
Mon Aug 28 18:26:48 CEST 2006
William O'Higgins Witteman wrote:
> On Mon, Aug 28, 2006 at 11:36:18AM -0400, Kent Johnson wrote:
>
>> William O'Higgins Witteman wrote:
>>
>>> Thank you for this. The problem is apparently not my syntax, but
>>> something else. Here is a pared-down snippet of what I'm doing:
>>>
>>> In [1]: import re
>>>
>>> In [2]: pat = re.compile('''
>>> ...:copy of
>>> ...:|
>>> ...:admin
>>> ...:''', re.IGNORECASE | re.VERBOSE)
>>>
>>>
>> But even if you do escape the space, I'm not sure what you expect to match. Colon is not special to regexes (except in non-grouping parentheses (?:...) ), so your regex expects literal colons in the string, which you don't have.
>>
>
> Um, that is the output of the iPython shell, which I thought you used.
> I just copied the output into the window. It indicates an indent. I
> didn't mean to muddy the waters. Sorry.
Uh, right. I guess it's my turn to look like an idiot :-) The indenting
got messed up so it looks like part of the code. (Yeah, that's right,
I'll blame it on the email software ;)
Kent
More information about the Tutor
mailing list