Thanks for picking this out as the offending regexp. It does match a
set of rather arbitrary strings, but since it's part of a parser for a
search query, users unfortunately often want to search for fairly
esoteric things. In any case, this was the problematic re. I've
replaced it a much simpler one that actually expresses what I intended
to search for in the first place, r'([^\(\s][^\s]*)?\:'. I'm looking
to match an arbitrary string which doesn't start with '(' and ends
with ':' (and has no spaces in it). Did you determine where the
problem lay by testing them, or was there something about its
structure which made it a likely suspect?

Thank you very much for your help,
Brock

On Feb 20, 8:03 am, Simon Cross <[email protected]> wrote:
> On Fri, Feb 20, 2009 at 3:51 PM, Simon Cross <[email protected]> wrote:
> > On Fri, Feb 20, 2009 at 12:22 AM, brock <[email protected]> wrote:
> >>                r'(\:?[^\(\s\:]?[^\s\:]*)*\:'
> > It also seems to be a rather odd sort of regular expression to be
> > matching a token with since it matches repeats of some fairly
> > arbitrary strings.
>
> The bit above is a misleading (I'm being kind and not calling myself wrong :).
>
> > Are you sure you can't use a regular expression like r'([^\s]+)*\:' (a
> > bit faster) or r'[^\s]*\:' (a LOT faster) instead? Possibly with some
> > post-processing elsewhere afterwards.
>
> I am of course being completely silly -- r'(\:?[^\(\s\:]?[^\s\:]*)*\:'
> and r'[^\s]*\:' match exactly the same set of strings.  The latter is
> about 100 000 times faster at failing to match short strings than the
> former.
>
> Hopefully my lack of sleep has not now led to make *two* somewhat
> silly posts. :)
>
> Schiavo
> Simon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ply-hack" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/ply-hack?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to