Besides, the time-intensive part is running it against a string, rather
than interpreting it.
There are a few things you can do to speed it up, but keep in mind that
all are marginal. Also, what "optimal" is depends on whether you expect
worse case, average case, or best case most of the time.
So, if you know your regex engine (and how it processes) you can do
things like:
minimize trackbacks
consolidate clauses
avoid backreferencing
etc.
Mastering Regular Expressions from O'reilly has a section on all of
this. Some of it is easy and obvious, and some isn't.
HTH.
--Ben
Jake wrote:
> All,
>
> I have an idea to implement the Movable Type plugin Blacklist
> (http://www.jayallen.org/projects/mt-blacklist/) into my blogging app.
>
> At its core, this plugin seems to be based on a pretty massive RegEx
> that is run on all comments that are posted to the blog in order to help
> to eliminate comment spamming.
> (http://www.jayallen.org/comment_spam/blacklist.txt)
>
> With such a massive RegEx, is there anyway to "cache" or ensure that
> using this RegEx doesn't add tons of time to each comment submission?
>
> It's late on a Thursday so my brain is slow to start. Anyone have any
> thoughts on this?
>
> Thanks!
> Jake
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

