Gilles Detillieux (grdetil@scrc.umanitoba.ca)
Wed, 5 May 1999 09:55:12 -0500 (CDT)
According to Torsten Neuer:
> According to Geoff Hutchison:
> >On Wed, 5 May 1999, Torsten Neuer wrote:
> >
> >> Well.. AFAIK brackets are used in regexp to define sets, so you'll
> >> run into trouble with a regexp like [^-%]* (which matches anything
> >> but '-' and '%'). Parenthesis are AFAIK used to create groups, so
> >> they are reserved for regexp as well. I'm not sure about {} though.
> >
> >No, no. I'm suggesting that the brackets be used to delimit a regex, then
> >be stripped off. So your regex would be:
> >
> >[[^-%]*]
> >
> >The outer set of [] are just saying "hey, I'm a regex, don't escape me!"
>
> Yep, of course.. stupid me (must be the lack of caffeine I experience today)..
It would work, but the two different meanings for the brackets could be a
bit confusing, especially for people who aren't that familiar with regular
expressions. My vote would be to go with parentheses as the delimiters
for a regex. Parentheses are used to group subexpressions, but I think
a group of one single expression is still valid. So, whether you strip
off the delimiters or not, I think using parentheses to introduce a regex
into the list of patterns makes sense. I also think they're "safe",
in that you're not likely to use parentheses normally in a StringMatch
pattern for URL pattern matching.
Geoff, the reason "gdbm*" matched "ggdb" is that "m*" means 0 or more
occurrences of "m", so "gdb" is a valid substring. If you want 1 or
more "m", you'd need to say "gdbmm*", or for some regex parsers "gdbm+".
I think what you intended was "gdbm.*", to get 0 or more occurrences of
any character after "gdbm".
-- Gilles R. Detillieux E-mail: <grdetil@scrc.umanitoba.ca> Spinal Cord Research Centre WWW: http://www.scrc.umanitoba.ca/~grdetil Dept. Physiology, U. of Manitoba Phone: (204)789-3766 Winnipeg, MB R3E 3J7 (Canada) Fax: (204)789-3930 ------------------------------------ To unsubscribe from the htdig3-dev mailing list, send a message to htdig3-dev@htdig.org containing the single word "unsubscribe" in the SUBJECT of the message.
This archive was generated by hypermail 2.0b3 on Wed May 05 1999 - 08:04:51 PDT