parser: using correct field for regexp expansion

Fixes: #1848
This commit is contained in:
Dirk-Jan C. Binnema
2020-12-05 10:38:39 +02:00
parent e9529c246c
commit 3010e614a3

View File

@ -212,7 +212,7 @@ Parser::Private::process_regex (const std::string& field, const std::regex& rx)
if (id == MU_MSG_FIELD_ID_NONE) if (id == MU_MSG_FIELD_ID_NONE)
return {}; return {};
char pfx[] = { mu_msg_field_xapian_prefix(id), '\0' }; char pfx[] = { mu_msg_field_shortcut(id), '\0' };
std::vector<std::string> terms; std::vector<std::string> terms;
store_.for_each_term(pfx,[&](auto&& str){ store_.for_each_term(pfx,[&](auto&& str){
@ -347,7 +347,7 @@ Parser::Private::data (Mu::Tokens& tokens, WarningVec& warnings) const
} }
// does it look like a regexp? // does it look like a regexp?
if (val.length() >=2 ) if (val.length() >= 2)
if (val[0] == '/' && val[val.length()-1] == '/') if (val[0] == '/' && val[val.length()-1] == '/')
return regex (fields, val, token.pos, warnings); return regex (fields, val, token.pos, warnings);