1

スペースを含むグロブ パターンを構築しようとしています。私は試しました\\(Javaとスペースであるため、エスケープをエスケープします)、[\\ ]および[[:space:]]. これを実装する方法がわかりません。シンプルでばかげているようですが、これに関するドキュメントは見つかりませんでした(sqlite glob implementation)。

[a-d]式の残りの部分で文字範囲 (など)を使用しているため、LIKE を使用できません。

4

2 に答える 2

2

GLOB ドキュメントはソース コードに隠されています。

Globbing rules:

     '*'       Matches any sequence of zero or more characters.

     '?'       Matches exactly one character.

    [...]      Matches one character from the enclosed list of
               characters.

    [^...]     Matches one character not in the enclosed list.

With the [...] and [^...] matching, a ']' character can be included
in the list by making it the first character after '[' or '^'.  A
range of characters can be specified using '-'.  Example:
"[a-z]" matches any single lower-case letter.  To match a '-', make
it the last character in the list.

Hints: to match '*' or '?', put them in "[]".  Like this:

        abc[*]xyz        Matches "abc*xyz" only

スペースは、パターン内のスペースのみと一致させることができます:

> SELECT ' ' GLOB ' ';
1
于 2013-10-27T19:12:47.237 に答える
0

[ ]構文を使用しました

*[ ]*文字列をスペースと一致させる

于 2013-10-27T12:49:43.453 に答える