Re: [htdig3-dev] Using Regex for htdig limits


Gilles Detillieux (grdetil@scrc.umanitoba.ca)
Wed, 19 May 1999 12:25:08 -0500 (CDT)


According to Vadim Chekan:
> Are there plans about using regex in other things?
> I'd like to have posibility to rewrite URLs on output.
> I need to delete port number from URL (I index my server on non default
> port)
> Now I do it in this way:
> Display.cc:244
> Display::displayMatch(DocumentRef *ref, int current)
> ..
> ..
> regex_t cmp;
> regmatch_t pmatch[3];
> int err;
> if ( (err=regcomp(&cmp,"(.*):[0-9]+(.*)",REG_EXTENDED))==0 ) {
> if ( (err=regexec(&cmp,url,3,pmatch,0))==0) {
> memcpy(url+pmatch[1].rm_eo,url+pmatch[2].rm_so,
> pmatch[2].rm_eo-pmatch[2].rm_so);
> url[pmatch[1].rm_eo+pmatch[2].rm_eo-pmatch[2].rm_so]='\0';
> }
> regfree(&cmp);
> }
>
> It would be nice if it will standart feature

I think you can do something like this with the url_part_aliases attribute,
although you'd probably need to match the port numbers exactly (not a problem
if there's just a few).

-- 
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 19 1999 - 09:37:51 PDT