Vadim Chekan (vadim@gc.lviv.ua)
Tue, 18 May 1999 12:20:13 +0300
Hello!
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
Vadim Chekan.
------------------------------------
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 Tue May 18 1999 - 02:35:20 PDT