[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

RE: [FWP] keyword parser for search engine



> From: Aaron Crane [mailto:aaron.crane@pobox.com]
> Sent: Monday, January 10, 2000 11:11
> To: fwp@technofile.org
> Subject: Re: [FWP] keyword parser for search engine
>
>
> Rick <rklement@pacbell.net> writes:
> > Given \000 as an available marker, let's twist a little more
> > and do this:
> >
> > sub locate_glob_to_regex {
> >   local $_ = "\000\000" . shift;
> >   s/\000\000\*/\000.*\000\000/ or
> >     s/\000\000\?/\000.\000\000/ or
> >     /\000\000\\$/ and return(undef) or
> >     s/\000\000(\\.|\w+)/$1\000\000/ or
> >     /\000\000\[[\!\^]\][^\]]*$/ and return(undef) or
> >     s/\000\000\[([\^\!]?)(\].*?)\]/\000[@{[$1 &&
> '^']}$2]\000\000/ or
> >     s/\000\000\[([\^\!]?)([^]]+)\]/\000[@{[$1 &&
> '^']}$2]\000\000/ or
> >     s/\000\000([^[])/\\$1\000\000/ or return(undef)
> >     until s/\000\000$//;
> >   $_ = "^$_\$" if tr/\000//d;
> >   return qr/$_/;
> > }
> >
> > By putting the \000 before the replacement, a second marker
> > is not needed.
>
> I like the new version, but it's a shame about all the \000 mess.  A
simple
> `my $z = qr/\000/;' at the top plus a global s/\\000/\$z/ should fix
that.

To me, "\0" is a lot less messy than "\000", as one of them is followed
by a [0-7] character.

--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com



==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe