Re: sorting an array of regexes
| From: | Adam i Agnieszka Gasiorowski FNORD | Date: | Tue, 18 Nov 2003 21:39:23 +0000 |
| Subject: | Re: sorting an array of regexes | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-170183@lists.php.net to get a copy of this message | ||
Curt Zirzow wrote:
> * Thus wrote Adam i Agnieszka Gasiorowski FNORD (agquarx@venus.ci.uw.edu.pl):
> > Eugene Lee wrote:
> >
> > > On Tue, Nov 18, 2003 at 01:15:32PM +0100, Adam i Agnieszka Gasiorowski FNORD wrote:
> > > :
> > > : There is an array of regexes, for example
> > > :
> > > : $array = array('moon', '[wh]ood', '[^as]eed' ...
> > > : (about 300 entries).
> > > :
> > > : I want to sort it comparing to the
> > > : character lenght of a regex. For example
> > > : [wh]ood is 4 characters, moon is 4 characters.
> > > : There are only letters of the alphabet and
> > > : letter ranges present in those regexes. I
> > > : want the "longest" ones first.
> > > :
> > > : How would you write the sorting function?
> > >
> > > This might be the most functionally correct, although it's definitely
> > > not the fastest route.
> >
> > Thank you, that will certainly work :8]. Does
> > anyone have any thoughts how to make it faster? It is
> > not VERY critical, because the calculation will be
> > done only once, at initialization, but...well, you
> > know :8].
>
> Do these change all the time or are they rather static? I would
> suggest using this routine to generate the list to be used in your
> program, instead of doing this on the fly.
Good idea...
--
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info { iWanToDie } WiNoNa ) (
http://szatanowskie-ladacznice.0-700.pl
foReVeR( * )
Poznaj jej zwiewne kształty... http://www.opera.com 007