[Groonga-commit] groonga/groonga at e4fab44 [master] regexp: use multiline mode

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Aug 26 15:46:06 JST 2015


Kouhei Sutou	2015-08-26 15:46:06 +0900 (Wed, 26 Aug 2015)

  New Revision: e4fab4423f156416390018069c1a3e3e391edab3
  https://github.com/groonga/groonga/commit/e4fab4423f156416390018069c1a3e3e391edab3

  Message:
    regexp: use multiline mode
    
    It means that "." matches to "\n".

  Modified files:
    lib/operator.c
    test/command/suite/select/filter/regexp/dot.expected
    test/command/suite/select/filter/regexp/dot.test

  Modified: lib/operator.c (+2 -1)
===================================================================
--- lib/operator.c    2015-08-25 15:06:17 +0900 (6b01dcc)
+++ lib/operator.c    2015-08-26 15:46:06 +0900 (f399534)
@@ -734,7 +734,8 @@ regexp_compile(grn_ctx *ctx, const char *pattern, unsigned int pattern_len)
   onig_result = onig_new(&regex,
                          pattern,
                          pattern + pattern_len,
-                         ONIG_OPTION_ASCII_RANGE,
+                         ONIG_OPTION_ASCII_RANGE |
+                         ONIG_OPTION_MULTILINE,
                          onig_encoding,
                          ONIG_SYNTAX_RUBY,
                          &onig_error_info);

  Modified: test/command/suite/select/filter/regexp/dot.expected (+23 -8)
===================================================================
--- test/command/suite/select/filter/regexp/dot.expected    2015-08-25 15:06:17 +0900 (fcface9)
+++ test/command/suite/select/filter/regexp/dot.expected    2015-08-26 15:46:06 +0900 (2778fb2)
@@ -8,12 +8,15 @@ column_create RegexpTokens memos_content COLUMN_INDEX|WITH_POSITION   Memos cont
 [[0,0.0,0.0],true]
 load --table Memos
 [
-{"content": "Groonga"},
-{"content": "Mroonga"},
-{"content": "mruby"}
+{"content": "alphabet: aXb"},
+{"content": "space:    a b"},
+{"content": "tab:      a\tb"},
+{"content": "CR:       a\rb"},
+{"content": "LF:       a\nb"},
+{"content": "not match: ab"}
 ]
-[[0,0.0,0.0],3]
-select Memos --filter 'content @~ ".ro"'
+[[0,0.0,0.0],6]
+select Memos --filter 'content @~ "a.b"'
 [
   [
     0,
@@ -23,7 +26,7 @@ select Memos --filter 'content @~ ".ro"'
   [
     [
       [
-        2
+        5
       ],
       [
         [
@@ -37,11 +40,23 @@ select Memos --filter 'content @~ ".ro"'
       ],
       [
         1,
-        "Groonga"
+        "alphabet: aXb"
       ],
       [
         2,
-        "Mroonga"
+        "space:    a b"
+      ],
+      [
+        3,
+        "tab:      a\tb"
+      ],
+      [
+        4,
+        "CR:       a\rb"
+      ],
+      [
+        5,
+        "LF:       a\nb"
       ]
     ]
   ]

  Modified: test/command/suite/select/filter/regexp/dot.test (+7 -4)
===================================================================
--- test/command/suite/select/filter/regexp/dot.test    2015-08-25 15:06:17 +0900 (13ee666)
+++ test/command/suite/select/filter/regexp/dot.test    2015-08-26 15:46:06 +0900 (45caa0f)
@@ -8,9 +8,12 @@ column_create RegexpTokens memos_content COLUMN_INDEX|WITH_POSITION \
 
 load --table Memos
 [
-{"content": "Groonga"},
-{"content": "Mroonga"},
-{"content": "mruby"}
+{"content": "alphabet: aXb"},
+{"content": "space:    a b"},
+{"content": "tab:      a\tb"},
+{"content": "CR:       a\rb"},
+{"content": "LF:       a\nb"},
+{"content": "not match: ab"}
 ]
 
-select Memos --filter 'content @~ ".ro"'
+select Memos --filter 'content @~ "a.b"'
-------------- next part --------------
HTML����������������������������...
다운로드 



More information about the Groonga-commit mailing list
Back to archive index