2

Using couchbase 5.1.1 and java client 2.6.1.

On database, I have bucket with name config and have one document:

[
 {
    "section": "MAIL",
    "id": "aaa.1.0.0.MAIL",
    "version": "1.0.0",
    "values": {
        "mail" : "test1@test1.com"
    }
 }
]

Now, I want to find doucment using regular expresion on fields:

bucket.query(new SearchQuery("configindex", SearchQuery.regexp(regexp).field("sectrion"));

If I put word using lowercase e.g.: mail, everything is fine and I recive document, but if I put word using uppercase like MAIL, what is exactly matches with fields value, I have no answear. Can You explain me, why I can't search using uppercase words?

EDIT:

If I put MA.* for regexp - it's not workig, ma.* - was working. I only want to know, why I can't use uppercase on regural expression when I have field value "section" : "MAIL". Why it's not working? but if I put "mail", it means lowercase on regexp, everythink was fine...

4

1 回答 1

1

作为猜测,如果您使用正则表达式,例如:"[a-z]"它只适用于小写字符。

假设您的正则表达式正在"[a-z]"尝试更改它,"[A-Za-z]"这将适用于大写和小写。就像是:

bucket.query(new SearchQuery("configindex", SearchQuery.regexp("[A-Za-z]").field("section"));
于 2018-08-08T08:29:11.720 回答