[Tutor] regex question

Richard D. Moores rdmoores at gmail.com
Tue Jan 4 18:44:53 CET 2011


On Tue, Jan 4, 2011 at 09:31, Brett Ritter <swiftone at swiftone.org> wrote:
> On Tue, Jan 4, 2011 at 10:37 AM, Richard D. Moores <rdmoores at gmail.com> wrote:
>> regex = ".*" + search + ".*"
>> p = re.compile(regex, re.I)

>
> Just having "search" as your regex is fine (it will search for the
> pattern _in_ the string, no need to specify the other parts of the
> string),

I see. Thanks.

> but if you're not using any special regex characters you're
> probably better off not using a regex and just using a string
> operation.

Please see my reply to Wayne Werner.

Dick


More information about the Tutor mailing list