dont explicitely anchor regexp in termMatch
This commit is contained in:
parent
159c0fdecf
commit
ce8ebf93d0
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.103 2007-01-19 10:23:26 dockes Exp $ (C) 2004 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.104 2007-01-25 15:47:23 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -1419,12 +1419,7 @@ bool Db::termMatch(MatchType typ, const string &lang,
|
|||||||
regex_t reg;
|
regex_t reg;
|
||||||
int errcode;
|
int errcode;
|
||||||
if (typ == ET_REGEXP) {
|
if (typ == ET_REGEXP) {
|
||||||
// Compile regexp. We anchor the input by enclosing it in ^ and $
|
|
||||||
string mroot = droot;
|
string mroot = droot;
|
||||||
if (mroot.at(0) != '^')
|
|
||||||
mroot = string("^") + mroot;
|
|
||||||
if (mroot.at(mroot.length()-1) != '$')
|
|
||||||
mroot += "$";
|
|
||||||
if ((errcode = regcomp(®, mroot.c_str(),
|
if ((errcode = regcomp(®, mroot.c_str(),
|
||||||
REG_EXTENDED|REG_NOSUB))) {
|
REG_EXTENDED|REG_NOSUB))) {
|
||||||
char errbuf[200];
|
char errbuf[200];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user