}
+#define REGEX_CHARS "^[]{}()|.*+?!\"$"
/**
* search_term: Parse CCL search term.
* cclp: CCL Parser
{
if (j > 0 && src_str[j-1] == '\\')
{
- if (regex_trunc && strchr("()[]?*.", src_str[j]))
+ if (regex_trunc && strchr(REGEX_CHARS "\\", src_str[j]))
{
regex_trunc = 2;
strcat(p->u.t.term, "\\\\");
}
+ if (src_str[j] == '\\')
+ strcat(p->u.t.term, "\\");
strxcat(p->u.t.term, src_str + j, 1);
}
else if (src_str[j] == '"')
}
else if (src_str[j] != '\\')
{
- if (regex_trunc && strchr("()[]?*.", src_str[j]))
+ if (regex_trunc && strchr(REGEX_CHARS, src_str[j]))
{
regex_trunc = 2;
strcat(p->u.t.term, "\\\\");
YAZ_CHECK(tst_ccl_query(bibset, "title=.",
"@attr 5=102 @attr 1=/my/title \\\\. "));
- YAZ_CHECK(tst_ccl_query(bibset, "title=\\.",
+ YAZ_CHECK(tst_ccl_query(bibset, "title=.",
"@attr 5=102 @attr 1=/my/title \\\\. "));
YAZ_CHECK(tst_ccl_query(bibset, "title=\".\"",
"@attr 5=102 @attr 1=/my/title \\\\. "));
+ YAZ_CHECK(tst_ccl_query(bibset, "title=?\\?",
+ "@attr 5=102 @attr 1=/my/title .*\\\\? "));
+
+ YAZ_CHECK(tst_ccl_query(bibset, "title=\"?\\?\"",
+ "@attr 5=102 @attr 1=/my/title \\\\?\\\\? "));
+
+ YAZ_CHECK(tst_ccl_query(bibset, "title=\\\\",
+ "@attr 5=102 @attr 1=/my/title \\\\\\\\ "));
+
+ YAZ_CHECK(tst_ccl_query(bibset, "\\\\",
+ "@attr 4=2 @attr 1=1016 \\\\ "));
+
YAZ_CHECK(tst_ccl_query(bibset, "comb=a",
"@or @attr 4=2 @attr 1=1016 a "
"@attr 1=/my/title a "));