[FRPythoneers] Regular Expressions

Sean Reifschneider jafo at tummy.com
Tue Jun 4 15:01:39 MDT 2002

On Tue, Jun 04, 2002 at 02:53:54PM -0600, J. Wayde Allen wrote:
>string so that would ultimately leave us with only those characters that
>don't match in the variable newfield.  Is this correct?


>I'm wondering, if for cgi page with a number of fields if compiling the
>match string before testing each field wouldn't be more efficient than
>compiling the string individually for each test?

Yeah, if you're handling more than a few dozen form submissions per second
you might find that compiling the regex and then using it repeatedly would
help.  If you are just planning to compile then use, compile a new one and
use, then it's not going to be any faster because that's effectively what's
happening now.

In fact, it might be slower because I believe that if you just give it a
regex, it will first see if it has a cached compiled version before
re-compiling it.  I don't know that if you explicitly request a compile
that it will do that.

 "You're thinking of Mr. Wizard."  "[Emilio Lizardo's] a top scientist,
 dumbkopf."  "So was Mr. Wizard."  -- _Buckaroo_Banzai_
Sean Reifschneider, Inimitably Superfluous <jafo at tummy.com>
tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python

More information about the FRPythoneers mailing list