github.com/dolthub/go-mysql-server@v0.18.0/enginetest/queries/regex_queries.go (about)

     1  // Copyright 2023 Dolthub, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  //go:build !race
    16  
    17  // Running tests with `-race` will cause issues with our regex implementation. Memory usage skyrockets, and execution
    18  // speed grinds to a halt as the pagefile/swap gets involved. Therefore, we do not run any regex tests when using the
    19  // `-race` flag.
    20  
    21  package queries
    22  
    23  import (
    24  	"gopkg.in/src-d/go-errors.v1"
    25  
    26  	regex "github.com/dolthub/go-icu-regex"
    27  
    28  	"github.com/dolthub/go-mysql-server/sql"
    29  )
    30  
    31  type RegexTest struct {
    32  	Query       string
    33  	Expected    []sql.Row
    34  	ExpectedErr *errors.Kind
    35  }
    36  
    37  var RegexTests = []RegexTest{
    38  	{
    39  		Query:    "SELECT REGEXP_LIKE('testing', 'TESTING');",
    40  		Expected: []sql.Row{{0}},
    41  	},
    42  	{
    43  		Query:    "SELECT REGEXP_LIKE('testing', 'TESTING', 'c');",
    44  		Expected: []sql.Row{{0}},
    45  	},
    46  	{
    47  		Query:    "SELECT REGEXP_LIKE('testing', 'TESTING', 'i');",
    48  		Expected: []sql.Row{{1}},
    49  	},
    50  	{
    51  		Query:    "SELECT REGEXP_LIKE('testing', 'TESTING', 'ci');",
    52  		Expected: []sql.Row{{1}},
    53  	},
    54  	{
    55  		Query:    "SELECT REGEXP_LIKE('testing', 'TESTING', 'ic');",
    56  		Expected: []sql.Row{{0}},
    57  	},
    58  	{
    59  		Query:    "SELECT REGEXP_LIKE('testing', 'TESTING' COLLATE utf8mb4_0900_ai_ci);",
    60  		Expected: []sql.Row{{1}},
    61  	},
    62  	{
    63  		Query:    "SELECT REGEXP_LIKE('testing', 'TESTING' COLLATE utf8mb4_0900_as_cs);",
    64  		Expected: []sql.Row{{0}},
    65  	},
    66  	{
    67  		Query: "SELECT REGEXP_LIKE('testing' COLLATE utf8mb4_0900_ai_ci, 'TESTING') FROM mytable;",
    68  		Expected: []sql.Row{
    69  			{1},
    70  			{1},
    71  			{1},
    72  		},
    73  	},
    74  	{
    75  		Query: "SELECT i, s, REGEXP_LIKE(s, '[a-z]+d row') FROM mytable;",
    76  		Expected: []sql.Row{
    77  			{1, "first row", 0},
    78  			{2, "second row", 1},
    79  			{3, "third row", 1},
    80  		},
    81  	},
    82  	{
    83  		Query:    `SELECT REGEXP_REPLACE("0123456789", "[0-4]", "X")`,
    84  		Expected: []sql.Row{{"XXXXX56789"}},
    85  	},
    86  	{
    87  		Query:    `SELECT REGEXP_REPLACE("0123456789", "[0-4]", "X", 2)`,
    88  		Expected: []sql.Row{{"0XXXX56789"}},
    89  	},
    90  	{
    91  		Query:    `SELECT REGEXP_REPLACE("0123456789", "[0-4]", "X", 2, 2)`,
    92  		Expected: []sql.Row{{"01X3456789"}},
    93  	},
    94  	{
    95  		Query:    `SELECT REGEXP_REPLACE("TEST test TEST", "[a-z]", "X", 1, 0, "i")`,
    96  		Expected: []sql.Row{{"XXXX XXXX XXXX"}},
    97  	},
    98  	{
    99  		Query:    `SELECT REGEXP_REPLACE("TEST test TEST", "[a-z]", "X", 1, 0, "c")`,
   100  		Expected: []sql.Row{{"TEST XXXX TEST"}},
   101  	},
   102  	{
   103  		Query:    `SELECT REGEXP_REPLACE(CONCAT("abc123"), "[0-4]", "X")`,
   104  		Expected: []sql.Row{{"abcXXX"}},
   105  	},
   106  	{
   107  		Query: `SELECT * FROM mytable WHERE s LIKE REGEXP_REPLACE("123456%r1o2w", "[0-9]", "")`,
   108  		Expected: []sql.Row{
   109  			{1, "first row"},
   110  			{2, "second row"},
   111  			{3, "third row"},
   112  		},
   113  	},
   114  	{
   115  		Query: `SELECT REGEXP_REPLACE(s, "[a-z]", "X") from mytable`,
   116  		Expected: []sql.Row{
   117  			{"XXXXX XXX"},
   118  			{"XXXXXX XXX"},
   119  			{"XXXXX XXX"},
   120  		},
   121  	},
   122  	{
   123  		Query:    `SELECT 20 REGEXP '^[-]?2[0-9]+$'`,
   124  		Expected: []sql.Row{{true}},
   125  	},
   126  	{
   127  		Query:    `SELECT 30 REGEXP '^[-]?2[0-9]+$'`,
   128  		Expected: []sql.Row{{false}},
   129  	},
   130  	{
   131  		Query:       `SELECT REGEXP_LIKE("", "(?P<foo_123");`,
   132  		ExpectedErr: regex.ErrInvalidRegex,
   133  	},
   134  	{
   135  		Query:       `SELECT REGEXP_LIKE("", "(?P<1>a)");`,
   136  		ExpectedErr: regex.ErrInvalidRegex,
   137  	},
   138  	{
   139  		Query:       `SELECT REGEXP_LIKE("", "(?P<!>a)");`,
   140  		ExpectedErr: regex.ErrInvalidRegex,
   141  	},
   142  	{
   143  		Query:       `SELECT REGEXP_LIKE("", "(?P<foo!>a)");`,
   144  		ExpectedErr: regex.ErrInvalidRegex,
   145  	},
   146  	{
   147  		Query:       `SELECT REGEXP_LIKE("aa", "(?P<foo_123>a)(?P=foo_123");`,
   148  		ExpectedErr: regex.ErrInvalidRegex,
   149  	},
   150  	{
   151  		Query:       `SELECT REGEXP_LIKE("aa", "(?P<foo_123>a)(?P=1)");`,
   152  		ExpectedErr: regex.ErrInvalidRegex,
   153  	},
   154  	{
   155  		Query:       `SELECT REGEXP_LIKE("aa", "(?P<foo_123>a)(?P=!)");`,
   156  		ExpectedErr: regex.ErrInvalidRegex,
   157  	},
   158  	{
   159  		Query:       `SELECT REGEXP_LIKE("aa", "(?P<foo_123>a)(?P=foo_124");`,
   160  		ExpectedErr: regex.ErrInvalidRegex,
   161  	},
   162  	{
   163  		Query:       `SELECT REGEXP_LIKE("a", "(?P<foo_123>a)");`,
   164  		ExpectedErr: regex.ErrInvalidRegex,
   165  	},
   166  	{
   167  		Query:       `SELECT REGEXP_LIKE("aa", "(?P<foo_123>a)(?P=foo_123)");`,
   168  		ExpectedErr: regex.ErrInvalidRegex,
   169  	},
   170  	{
   171  		Query:       `SELECT REGEXP_LIKE("a", "\\1");`,
   172  		ExpectedErr: regex.ErrInvalidRegex,
   173  	},
   174  	{
   175  		Query:    `SELECT REGEXP_LIKE("\1", "[\\1]");`,
   176  		Expected: []sql.Row{{1}},
   177  	},
   178  	{
   179  		Query:       `SELECT REGEXP_LIKE("a", "\\141");`,
   180  		ExpectedErr: regex.ErrInvalidRegex,
   181  	},
   182  	{
   183  		Query:    `SELECT REGEXP_LIKE("\000", "\000");`,
   184  		Expected: []sql.Row{{1}},
   185  	},
   186  	{
   187  		Query:    `SELECT REGEXP_LIKE("\000", "[\000a]");`,
   188  		Expected: []sql.Row{{1}},
   189  	},
   190  	{
   191  		Query:    `SELECT REGEXP_LIKE("\000", "[a\000]");`,
   192  		Expected: []sql.Row{{1}},
   193  	},
   194  	{
   195  		Query:    `SELECT REGEXP_LIKE("\000", "[^a\000]");`,
   196  		Expected: []sql.Row{{0}},
   197  	},
   198  	{
   199  		Query:    `SELECT REGEXP_LIKE("\a\b\f\n\r\t\v", "\a[\b]\f\n\r\t\v");`,
   200  		Expected: []sql.Row{{1}},
   201  	},
   202  	{
   203  		Query:    `SELECT REGEXP_LIKE("\a\b\f\n\r\t\v", "[\a][\b][\f][\n][\r][\t][\v]");`,
   204  		Expected: []sql.Row{{1}},
   205  	},
   206  	{
   207  		Query:    `SELECT REGEXP_LIKE("", "\u");`,
   208  		Expected: []sql.Row{{0}},
   209  	},
   210  	{
   211  		Query:    `SELECT REGEXP_LIKE("\377", "\xff");`,
   212  		Expected: []sql.Row{{0}},
   213  	},
   214  	{
   215  		Query:    `SELECT REGEXP_LIKE("\377", "\x00ffffffffffffff");`,
   216  		Expected: []sql.Row{{0}},
   217  	},
   218  	{
   219  		Query:    `SELECT REGEXP_LIKE("\017", "\x00f");`,
   220  		Expected: []sql.Row{{0}},
   221  	},
   222  	{
   223  		Query:    `SELECT REGEXP_LIKE("\376", "\x00fe");`,
   224  		Expected: []sql.Row{{0}},
   225  	},
   226  	{
   227  		Query:    `SELECT REGEXP_LIKE("SRC=eval.c g.c blah blah blah \\\\\n\tapes.c", "^\w+=(\\[\000-\277]|[^\n\\\\])*");`,
   228  		Expected: []sql.Row{{0}},
   229  	},
   230  	{
   231  		Query:    `SELECT REGEXP_LIKE("acb", "a.b");`,
   232  		Expected: []sql.Row{{1}},
   233  	},
   234  	{
   235  		Query:    `SELECT REGEXP_LIKE("a\nb", "a.b");`,
   236  		Expected: []sql.Row{{0}},
   237  	},
   238  	{
   239  		Query:    `SELECT REGEXP_LIKE("acc\nccb", "a.*b");`,
   240  		Expected: []sql.Row{{0}},
   241  	},
   242  	{
   243  		Query:    `SELECT REGEXP_LIKE("acc\nccb", "a.{4,5}b");`,
   244  		Expected: []sql.Row{{0}},
   245  	},
   246  	{
   247  		Query:    `SELECT REGEXP_LIKE("a\rb", "a.b");`,
   248  		Expected: []sql.Row{{0}},
   249  	},
   250  	{
   251  		Query:    `SELECT REGEXP_LIKE("a\nb", "(?s)a.b");`,
   252  		Expected: []sql.Row{{1}},
   253  	},
   254  	{
   255  		Query:    `SELECT REGEXP_LIKE("acc\nccb", "(?s)a.*b");`,
   256  		Expected: []sql.Row{{1}},
   257  	},
   258  	{
   259  		Query:    `SELECT REGEXP_LIKE("acc\nccb", "(?s)a.{4,5}b");`,
   260  		Expected: []sql.Row{{1}},
   261  	},
   262  	{
   263  		Query:    `SELECT REGEXP_LIKE("a\nb", "(?s)a.b");`,
   264  		Expected: []sql.Row{{1}},
   265  	},
   266  	{
   267  		Query:       `SELECT REGEXP_LIKE("", ")");`,
   268  		ExpectedErr: regex.ErrInvalidRegex,
   269  	},
   270  	{
   271  		Query:       `SELECT REGEXP_LIKE("", "");`,
   272  		ExpectedErr: regex.ErrInvalidRegex,
   273  	},
   274  	{
   275  		Query:    `SELECT REGEXP_LIKE("abc", "abc");`,
   276  		Expected: []sql.Row{{1}},
   277  	},
   278  	{
   279  		Query:    `SELECT REGEXP_LIKE("xbc", "abc");`,
   280  		Expected: []sql.Row{{0}},
   281  	},
   282  	{
   283  		Query:    `SELECT REGEXP_LIKE("axc", "abc");`,
   284  		Expected: []sql.Row{{0}},
   285  	},
   286  	{
   287  		Query:    `SELECT REGEXP_LIKE("abx", "abc");`,
   288  		Expected: []sql.Row{{0}},
   289  	},
   290  	{
   291  		Query:    `SELECT REGEXP_LIKE("xabcy", "abc");`,
   292  		Expected: []sql.Row{{1}},
   293  	},
   294  	{
   295  		Query:    `SELECT REGEXP_LIKE("ababc", "abc");`,
   296  		Expected: []sql.Row{{1}},
   297  	},
   298  	{
   299  		Query:    `SELECT REGEXP_LIKE("abc", "ab*c");`,
   300  		Expected: []sql.Row{{1}},
   301  	},
   302  	{
   303  		Query:    `SELECT REGEXP_LIKE("abc", "ab*bc");`,
   304  		Expected: []sql.Row{{1}},
   305  	},
   306  	{
   307  		Query:    `SELECT REGEXP_LIKE("abbc", "ab*bc");`,
   308  		Expected: []sql.Row{{1}},
   309  	},
   310  	{
   311  		Query:    `SELECT REGEXP_LIKE("abbbbc", "ab*bc");`,
   312  		Expected: []sql.Row{{1}},
   313  	},
   314  	{
   315  		Query:    `SELECT REGEXP_LIKE("abbc", "ab+bc");`,
   316  		Expected: []sql.Row{{1}},
   317  	},
   318  	{
   319  		Query:    `SELECT REGEXP_LIKE("abc", "ab+bc");`,
   320  		Expected: []sql.Row{{0}},
   321  	},
   322  	{
   323  		Query:    `SELECT REGEXP_LIKE("abq", "ab+bc");`,
   324  		Expected: []sql.Row{{0}},
   325  	},
   326  	{
   327  		Query:    `SELECT REGEXP_LIKE("abbbbc", "ab+bc");`,
   328  		Expected: []sql.Row{{1}},
   329  	},
   330  	{
   331  		Query:    `SELECT REGEXP_LIKE("abbc", "ab?bc");`,
   332  		Expected: []sql.Row{{1}},
   333  	},
   334  	{
   335  		Query:    `SELECT REGEXP_LIKE("abc", "ab?bc");`,
   336  		Expected: []sql.Row{{1}},
   337  	},
   338  	{
   339  		Query:    `SELECT REGEXP_LIKE("abbbbc", "ab?bc");`,
   340  		Expected: []sql.Row{{0}},
   341  	},
   342  	{
   343  		Query:    `SELECT REGEXP_LIKE("abc", "ab?c");`,
   344  		Expected: []sql.Row{{1}},
   345  	},
   346  	{
   347  		Query:    `SELECT REGEXP_LIKE("abc", "^abc$");`,
   348  		Expected: []sql.Row{{1}},
   349  	},
   350  	{
   351  		Query:    `SELECT REGEXP_LIKE("abcc", "^abc$");`,
   352  		Expected: []sql.Row{{0}},
   353  	},
   354  	{
   355  		Query:    `SELECT REGEXP_LIKE("abcc", "^abc");`,
   356  		Expected: []sql.Row{{1}},
   357  	},
   358  	{
   359  		Query:    `SELECT REGEXP_LIKE("aabc", "^abc$");`,
   360  		Expected: []sql.Row{{0}},
   361  	},
   362  	{
   363  		Query:    `SELECT REGEXP_LIKE("aabc", "abc$");`,
   364  		Expected: []sql.Row{{1}},
   365  	},
   366  	{
   367  		Query:    `SELECT REGEXP_LIKE("abc", "^");`,
   368  		Expected: []sql.Row{{1}},
   369  	},
   370  	{
   371  		Query:    `SELECT REGEXP_LIKE("abc", "$");`,
   372  		Expected: []sql.Row{{1}},
   373  	},
   374  	{
   375  		Query:    `SELECT REGEXP_LIKE("abc", "a.c");`,
   376  		Expected: []sql.Row{{1}},
   377  	},
   378  	{
   379  		Query:    `SELECT REGEXP_LIKE("axc", "a.c");`,
   380  		Expected: []sql.Row{{1}},
   381  	},
   382  	{
   383  		Query:    `SELECT REGEXP_LIKE("axyzc", "a.*c");`,
   384  		Expected: []sql.Row{{1}},
   385  	},
   386  	{
   387  		Query:    `SELECT REGEXP_LIKE("axyzd", "a.*c");`,
   388  		Expected: []sql.Row{{0}},
   389  	},
   390  	{
   391  		Query:    `SELECT REGEXP_LIKE("abc", "a[bc]d");`,
   392  		Expected: []sql.Row{{0}},
   393  	},
   394  	{
   395  		Query:    `SELECT REGEXP_LIKE("abd", "a[bc]d");`,
   396  		Expected: []sql.Row{{1}},
   397  	},
   398  	{
   399  		Query:    `SELECT REGEXP_LIKE("abd", "a[b-d]e");`,
   400  		Expected: []sql.Row{{0}},
   401  	},
   402  	{
   403  		Query:    `SELECT REGEXP_LIKE("ace", "a[b-d]e");`,
   404  		Expected: []sql.Row{{1}},
   405  	},
   406  	{
   407  		Query:    `SELECT REGEXP_LIKE("aac", "a[b-d]");`,
   408  		Expected: []sql.Row{{1}},
   409  	},
   410  	{
   411  		Query:    `SELECT REGEXP_LIKE("a-", "a[-b]");`,
   412  		Expected: []sql.Row{{1}},
   413  	},
   414  	{
   415  		Query:    `SELECT REGEXP_LIKE("a-", "a[\\-b]");`,
   416  		Expected: []sql.Row{{1}},
   417  	},
   418  	{
   419  		Query:       `SELECT REGEXP_LIKE("-", "a[]b");`,
   420  		ExpectedErr: regex.ErrInvalidRegex,
   421  	},
   422  	{
   423  		Query:       `SELECT REGEXP_LIKE("-", "a[");`,
   424  		ExpectedErr: regex.ErrInvalidRegex,
   425  	},
   426  	{
   427  		Query:       `SELECT REGEXP_LIKE("-", "a\\");`,
   428  		ExpectedErr: regex.ErrInvalidRegex,
   429  	},
   430  	{
   431  		Query:       `SELECT REGEXP_LIKE("-", "abc)");`,
   432  		ExpectedErr: regex.ErrInvalidRegex,
   433  	},
   434  	{
   435  		Query:       `SELECT REGEXP_LIKE("-", "(abc");`,
   436  		ExpectedErr: regex.ErrInvalidRegex,
   437  	},
   438  	{
   439  		Query:    `SELECT REGEXP_LIKE("a]", "a]");`,
   440  		Expected: []sql.Row{{1}},
   441  	},
   442  	{
   443  		Query:    `SELECT REGEXP_LIKE("a]b", "a[]]b");`,
   444  		Expected: []sql.Row{{1}},
   445  	},
   446  	{
   447  		Query:    `SELECT REGEXP_LIKE("a]b", "a[\\]]b");`,
   448  		Expected: []sql.Row{{1}},
   449  	},
   450  	{
   451  		Query:    `SELECT REGEXP_LIKE("aed", "a[^bc]d");`,
   452  		Expected: []sql.Row{{1}},
   453  	},
   454  	{
   455  		Query:    `SELECT REGEXP_LIKE("abd", "a[^bc]d");`,
   456  		Expected: []sql.Row{{0}},
   457  	},
   458  	{
   459  		Query:    `SELECT REGEXP_LIKE("adc", "a[^-b]c");`,
   460  		Expected: []sql.Row{{1}},
   461  	},
   462  	{
   463  		Query:    `SELECT REGEXP_LIKE("a-c", "a[^-b]c");`,
   464  		Expected: []sql.Row{{0}},
   465  	},
   466  	{
   467  		Query:    `SELECT REGEXP_LIKE("a]c", "a[^]b]c");`,
   468  		Expected: []sql.Row{{0}},
   469  	},
   470  	{
   471  		Query:    `SELECT REGEXP_LIKE("adc", "a[^]b]c");`,
   472  		Expected: []sql.Row{{1}},
   473  	},
   474  	{
   475  		Query:    `SELECT REGEXP_LIKE("a-", "\\ba\\b");`,
   476  		Expected: []sql.Row{{1}},
   477  	},
   478  	{
   479  		Query:    `SELECT REGEXP_LIKE("-a", "\\ba\\b");`,
   480  		Expected: []sql.Row{{1}},
   481  	},
   482  	{
   483  		Query:    `SELECT REGEXP_LIKE("-a-", "\\ba\\b");`,
   484  		Expected: []sql.Row{{1}},
   485  	},
   486  	{
   487  		Query:    `SELECT REGEXP_LIKE("xy", "\\by\\b");`,
   488  		Expected: []sql.Row{{0}},
   489  	},
   490  	{
   491  		Query:    `SELECT REGEXP_LIKE("yz", "\\by\\b");`,
   492  		Expected: []sql.Row{{0}},
   493  	},
   494  	{
   495  		Query:    `SELECT REGEXP_LIKE("xyz", "\\by\\b");`,
   496  		Expected: []sql.Row{{0}},
   497  	},
   498  	{
   499  		Query:    `SELECT REGEXP_LIKE("xyz", "x\\b");`,
   500  		Expected: []sql.Row{{0}},
   501  	},
   502  	{
   503  		Query:    `SELECT REGEXP_LIKE("xyz", "x\\B");`,
   504  		Expected: []sql.Row{{1}},
   505  	},
   506  	{
   507  		Query:    `SELECT REGEXP_LIKE("xyz", "\\Bz");`,
   508  		Expected: []sql.Row{{1}},
   509  	},
   510  	{
   511  		Query:    `SELECT REGEXP_LIKE("xyz", "z\\B");`,
   512  		Expected: []sql.Row{{0}},
   513  	},
   514  	{
   515  		Query:    `SELECT REGEXP_LIKE("xyz", "\\Bx");`,
   516  		Expected: []sql.Row{{0}},
   517  	},
   518  	{
   519  		Query:    `SELECT REGEXP_LIKE("a-", "\\Ba\\B");`,
   520  		Expected: []sql.Row{{0}},
   521  	},
   522  	{
   523  		Query:    `SELECT REGEXP_LIKE("-a", "\\Ba\\B");`,
   524  		Expected: []sql.Row{{0}},
   525  	},
   526  	{
   527  		Query:    `SELECT REGEXP_LIKE("-a-", "\\Ba\\B");`,
   528  		Expected: []sql.Row{{0}},
   529  	},
   530  	{
   531  		Query:    `SELECT REGEXP_LIKE("xy", "\\By\\B");`,
   532  		Expected: []sql.Row{{0}},
   533  	},
   534  	{
   535  		Query:    `SELECT REGEXP_LIKE("yz", "\\By\\B");`,
   536  		Expected: []sql.Row{{0}},
   537  	},
   538  	{
   539  		Query:    `SELECT REGEXP_LIKE("xy", "\\By\\b");`,
   540  		Expected: []sql.Row{{1}},
   541  	},
   542  	{
   543  		Query:    `SELECT REGEXP_LIKE("yz", "\\by\\B");`,
   544  		Expected: []sql.Row{{1}},
   545  	},
   546  	{
   547  		Query:    `SELECT REGEXP_LIKE("xyz", "\\By\\B");`,
   548  		Expected: []sql.Row{{1}},
   549  	},
   550  	{
   551  		Query:    `SELECT REGEXP_LIKE("abc", "ab|cd");`,
   552  		Expected: []sql.Row{{1}},
   553  	},
   554  	{
   555  		Query:    `SELECT REGEXP_LIKE("abcd", "ab|cd");`,
   556  		Expected: []sql.Row{{1}},
   557  	},
   558  	{
   559  		Query:    `SELECT REGEXP_LIKE("def", "()ef");`,
   560  		Expected: []sql.Row{{1}},
   561  	},
   562  	{
   563  		Query:    `SELECT REGEXP_LIKE("b", "$b");`,
   564  		Expected: []sql.Row{{0}},
   565  	},
   566  	{
   567  		Query:    `SELECT REGEXP_LIKE("a(b", "a\\(b");`,
   568  		Expected: []sql.Row{{1}},
   569  	},
   570  	{
   571  		Query:    `SELECT REGEXP_LIKE("ab", "a\\(*b");`,
   572  		Expected: []sql.Row{{1}},
   573  	},
   574  	{
   575  		Query:    `SELECT REGEXP_LIKE("a((b", "a\\(*b");`,
   576  		Expected: []sql.Row{{1}},
   577  	},
   578  	{
   579  		Query:    `SELECT REGEXP_LIKE("a\\b", "a\\\\b");`,
   580  		Expected: []sql.Row{{1}},
   581  	},
   582  	{
   583  		Query:    `SELECT REGEXP_LIKE("abc", "((a))");`,
   584  		Expected: []sql.Row{{1}},
   585  	},
   586  	{
   587  		Query:    `SELECT REGEXP_LIKE("abc", "(a)b(c)");`,
   588  		Expected: []sql.Row{{1}},
   589  	},
   590  	{
   591  		Query:    `SELECT REGEXP_LIKE("aabbabc", "a+b+c");`,
   592  		Expected: []sql.Row{{1}},
   593  	},
   594  	{
   595  		Query:    `SELECT REGEXP_LIKE("ab", "(a+|b)*");`,
   596  		Expected: []sql.Row{{1}},
   597  	},
   598  	{
   599  		Query:    `SELECT REGEXP_LIKE("ab", "(a+|b)+");`,
   600  		Expected: []sql.Row{{1}},
   601  	},
   602  	{
   603  		Query:    `SELECT REGEXP_LIKE("ab", "(a+|b)?");`,
   604  		Expected: []sql.Row{{1}},
   605  	},
   606  	{
   607  		Query:       `SELECT REGEXP_LIKE("-", ")(");`,
   608  		ExpectedErr: regex.ErrInvalidRegex,
   609  	},
   610  	{
   611  		Query:    `SELECT REGEXP_LIKE("cde", "[^ab]*");`,
   612  		Expected: []sql.Row{{1}},
   613  	},
   614  	{
   615  		Query:    `SELECT REGEXP_LIKE("", "abc");`,
   616  		Expected: []sql.Row{{0}},
   617  	},
   618  	{
   619  		Query:    `SELECT REGEXP_LIKE("", "a*");`,
   620  		Expected: []sql.Row{{1}},
   621  	},
   622  	{
   623  		Query:    `SELECT REGEXP_LIKE("e", "a|b|c|d|e");`,
   624  		Expected: []sql.Row{{1}},
   625  	},
   626  	{
   627  		Query:    `SELECT REGEXP_LIKE("ef", "(a|b|c|d|e)f");`,
   628  		Expected: []sql.Row{{1}},
   629  	},
   630  	{
   631  		Query:    `SELECT REGEXP_LIKE("abcdefg", "abcd*efg");`,
   632  		Expected: []sql.Row{{1}},
   633  	},
   634  	{
   635  		Query:    `SELECT REGEXP_LIKE("xabyabbbz", "ab*");`,
   636  		Expected: []sql.Row{{1}},
   637  	},
   638  	{
   639  		Query:    `SELECT REGEXP_LIKE("xayabbbz", "ab*");`,
   640  		Expected: []sql.Row{{1}},
   641  	},
   642  	{
   643  		Query:    `SELECT REGEXP_LIKE("abcde", "(ab|cd)e");`,
   644  		Expected: []sql.Row{{1}},
   645  	},
   646  	{
   647  		Query:    `SELECT REGEXP_LIKE("hij", "[abhgefdc]ij");`,
   648  		Expected: []sql.Row{{1}},
   649  	},
   650  	{
   651  		Query:    `SELECT REGEXP_LIKE("abcde", "^(ab|cd)e");`,
   652  		Expected: []sql.Row{{0}},
   653  	},
   654  	{
   655  		Query:    `SELECT REGEXP_LIKE("abcdef", "(abc|)ef");`,
   656  		Expected: []sql.Row{{1}},
   657  	},
   658  	{
   659  		Query:    `SELECT REGEXP_LIKE("abcd", "(a|b)c*d");`,
   660  		Expected: []sql.Row{{1}},
   661  	},
   662  	{
   663  		Query:    `SELECT REGEXP_LIKE("abc", "(ab|ab*)bc");`,
   664  		Expected: []sql.Row{{1}},
   665  	},
   666  	{
   667  		Query:    `SELECT REGEXP_LIKE("abc", "a([bc]*)c*");`,
   668  		Expected: []sql.Row{{1}},
   669  	},
   670  	{
   671  		Query:    `SELECT REGEXP_LIKE("abcd", "a([bc]*)(c*d)");`,
   672  		Expected: []sql.Row{{1}},
   673  	},
   674  	{
   675  		Query:    `SELECT REGEXP_LIKE("abcd", "a([bc]+)(c*d)");`,
   676  		Expected: []sql.Row{{1}},
   677  	},
   678  	{
   679  		Query:    `SELECT REGEXP_LIKE("abcd", "a([bc]*)(c+d)");`,
   680  		Expected: []sql.Row{{1}},
   681  	},
   682  	{
   683  		Query:    `SELECT REGEXP_LIKE("adcdcde", "a[bcd]*dcdcde");`,
   684  		Expected: []sql.Row{{1}},
   685  	},
   686  	{
   687  		Query:    `SELECT REGEXP_LIKE("adcdcde", "a[bcd]+dcdcde");`,
   688  		Expected: []sql.Row{{0}},
   689  	},
   690  	{
   691  		Query:    `SELECT REGEXP_LIKE("abc", "(ab|a)b*c");`,
   692  		Expected: []sql.Row{{1}},
   693  	},
   694  	{
   695  		Query:    `SELECT REGEXP_LIKE("abcd", "((a)(b)c)(d)");`,
   696  		Expected: []sql.Row{{1}},
   697  	},
   698  	{
   699  		Query:    `SELECT REGEXP_LIKE("alpha", "[a-zA-Z_][a-zA-Z0-9_]*");`,
   700  		Expected: []sql.Row{{1}},
   701  	},
   702  	{
   703  		Query:    `SELECT REGEXP_LIKE("abh", "^a(bc+|b[eh])g|.h$");`,
   704  		Expected: []sql.Row{{1}},
   705  	},
   706  	{
   707  		Query:    `SELECT REGEXP_LIKE("effgz", "(bc+d$|ef*g.|h?i(j|k))");`,
   708  		Expected: []sql.Row{{1}},
   709  	},
   710  	{
   711  		Query:    `SELECT REGEXP_LIKE("ij", "(bc+d$|ef*g.|h?i(j|k))");`,
   712  		Expected: []sql.Row{{1}},
   713  	},
   714  	{
   715  		Query:    `SELECT REGEXP_LIKE("effg", "(bc+d$|ef*g.|h?i(j|k))");`,
   716  		Expected: []sql.Row{{0}},
   717  	},
   718  	{
   719  		Query:    `SELECT REGEXP_LIKE("bcdd", "(bc+d$|ef*g.|h?i(j|k))");`,
   720  		Expected: []sql.Row{{0}},
   721  	},
   722  	{
   723  		Query:    `SELECT REGEXP_LIKE("reffgz", "(bc+d$|ef*g.|h?i(j|k))");`,
   724  		Expected: []sql.Row{{1}},
   725  	},
   726  	{
   727  		Query:    `SELECT REGEXP_LIKE("a", "(((((((((a)))))))))");`,
   728  		Expected: []sql.Row{{1}},
   729  	},
   730  	{
   731  		Query:    `SELECT REGEXP_LIKE("uh-uh", "multiple words of text");`,
   732  		Expected: []sql.Row{{0}},
   733  	},
   734  	{
   735  		Query:    `SELECT REGEXP_LIKE("multiple words, yeah", "multiple words");`,
   736  		Expected: []sql.Row{{1}},
   737  	},
   738  	{
   739  		Query:    `SELECT REGEXP_LIKE("abcde", "(.*)c(.*)");`,
   740  		Expected: []sql.Row{{1}},
   741  	},
   742  	{
   743  		Query:    `SELECT REGEXP_LIKE("(a, b)", "\\((.*), (.*)\\)");`,
   744  		Expected: []sql.Row{{1}},
   745  	},
   746  	{
   747  		Query:    `SELECT REGEXP_LIKE("ab", "[k]");`,
   748  		Expected: []sql.Row{{0}},
   749  	},
   750  	{
   751  		Query:    `SELECT REGEXP_LIKE("ac", "a[-]?c");`,
   752  		Expected: []sql.Row{{1}},
   753  	},
   754  	{
   755  		Query:    `SELECT REGEXP_LIKE("abcabc", "(abc)\\1");`,
   756  		Expected: []sql.Row{{1}},
   757  	},
   758  	{
   759  		Query:    `SELECT REGEXP_LIKE("abcabc", "([a-c]*)\\1");`,
   760  		Expected: []sql.Row{{1}},
   761  	},
   762  	{
   763  		Query:    `SELECT REGEXP_LIKE("AB", "^(.+)?B");`,
   764  		Expected: []sql.Row{{1}},
   765  	},
   766  	{
   767  		Query:    `SELECT REGEXP_LIKE("aaaaa", "(a+).\\1$");`,
   768  		Expected: []sql.Row{{1}},
   769  	},
   770  	{
   771  		Query:    `SELECT REGEXP_LIKE("aaaa", "^(a+).\\1$");`,
   772  		Expected: []sql.Row{{0}},
   773  	},
   774  	{
   775  		Query:    `SELECT REGEXP_LIKE("abcabc", "(abc)\\1");`,
   776  		Expected: []sql.Row{{1}},
   777  	},
   778  	{
   779  		Query:    `SELECT REGEXP_LIKE("abcabc", "([a-c]+)\\1");`,
   780  		Expected: []sql.Row{{1}},
   781  	},
   782  	{
   783  		Query:    `SELECT REGEXP_LIKE("aa", "(a)\\1");`,
   784  		Expected: []sql.Row{{1}},
   785  	},
   786  	{
   787  		Query:    `SELECT REGEXP_LIKE("aa", "(a+)\\1");`,
   788  		Expected: []sql.Row{{1}},
   789  	},
   790  	{
   791  		Query:    `SELECT REGEXP_LIKE("aa", "(a+)+\\1");`,
   792  		Expected: []sql.Row{{1}},
   793  	},
   794  	{
   795  		Query:    `SELECT REGEXP_LIKE("aba", "(a).+\\1");`,
   796  		Expected: []sql.Row{{1}},
   797  	},
   798  	{
   799  		Query:    `SELECT REGEXP_LIKE("aba", "(a)ba*\\1");`,
   800  		Expected: []sql.Row{{1}},
   801  	},
   802  	{
   803  		Query:    `SELECT REGEXP_LIKE("aaa", "(aa|a)a\\1$");`,
   804  		Expected: []sql.Row{{1}},
   805  	},
   806  	{
   807  		Query:    `SELECT REGEXP_LIKE("aaa", "(a|aa)a\\1$");`,
   808  		Expected: []sql.Row{{1}},
   809  	},
   810  	{
   811  		Query:    `SELECT REGEXP_LIKE("aaa", "(a+)a\\1$");`,
   812  		Expected: []sql.Row{{1}},
   813  	},
   814  	{
   815  		Query:    `SELECT REGEXP_LIKE("abcabc", "([abc]*)\\1");`,
   816  		Expected: []sql.Row{{1}},
   817  	},
   818  	{
   819  		Query:    `SELECT REGEXP_LIKE("ab", "(a)(b)c|ab");`,
   820  		Expected: []sql.Row{{1}},
   821  	},
   822  	{
   823  		Query:    `SELECT REGEXP_LIKE("aaax", "(a)+x");`,
   824  		Expected: []sql.Row{{1}},
   825  	},
   826  	{
   827  		Query:    `SELECT REGEXP_LIKE("aacx", "([ac])+x");`,
   828  		Expected: []sql.Row{{1}},
   829  	},
   830  	{
   831  		Query:    `SELECT REGEXP_LIKE("d:msgs/tdir/sub1/trial/away.cpp", "([^/]*/)*sub1/");`,
   832  		Expected: []sql.Row{{1}},
   833  	},
   834  	{
   835  		Query:    `SELECT REGEXP_LIKE("track1.title:TBlah blah blah", "([^.]*)\\.([^:]*):[T ]+(.*)");`,
   836  		Expected: []sql.Row{{1}},
   837  	},
   838  	{
   839  		Query:    `SELECT REGEXP_LIKE("abNNxyzN", "([^N]*N)+");`,
   840  		Expected: []sql.Row{{1}},
   841  	},
   842  	{
   843  		Query:    `SELECT REGEXP_LIKE("abNNxyz", "([^N]*N)+");`,
   844  		Expected: []sql.Row{{1}},
   845  	},
   846  	{
   847  		Query:    `SELECT REGEXP_LIKE("abcx", "([abc]*)x");`,
   848  		Expected: []sql.Row{{1}},
   849  	},
   850  	{
   851  		Query:    `SELECT REGEXP_LIKE("abc", "([abc]*)x");`,
   852  		Expected: []sql.Row{{0}},
   853  	},
   854  	{
   855  		Query:    `SELECT REGEXP_LIKE("abcx", "([xyz]*)x");`,
   856  		Expected: []sql.Row{{1}},
   857  	},
   858  	{
   859  		Query:    `SELECT REGEXP_LIKE("aac", "(a)+b|aac");`,
   860  		Expected: []sql.Row{{1}},
   861  	},
   862  	{
   863  		Query:       `SELECT REGEXP_LIKE("aaaa", "(?P<i d>aaa)a");`,
   864  		ExpectedErr: regex.ErrInvalidRegex,
   865  	},
   866  	{
   867  		Query:       `SELECT REGEXP_LIKE("aaaa", "(?P<id>aaa)a");`,
   868  		ExpectedErr: regex.ErrInvalidRegex,
   869  	},
   870  	{
   871  		Query:       `SELECT REGEXP_LIKE("aaaa", "(?P<id>aa)(?P=id)");`,
   872  		ExpectedErr: regex.ErrInvalidRegex,
   873  	},
   874  	{
   875  		Query:       `SELECT REGEXP_LIKE("aaaa", "(?P<id>aa)(?P=xd)");`,
   876  		ExpectedErr: regex.ErrInvalidRegex,
   877  	},
   878  	{
   879  		Query:       `SELECT REGEXP_LIKE("a", "\\1");`,
   880  		ExpectedErr: regex.ErrInvalidRegex,
   881  	},
   882  	{
   883  		Query:       `SELECT REGEXP_LIKE("abcdefghijklk9", "(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\\\119");`,
   884  		ExpectedErr: regex.ErrInvalidRegex,
   885  	},
   886  	{
   887  		Query:    `SELECT REGEXP_LIKE("abc", "abc");`,
   888  		Expected: []sql.Row{{1}},
   889  	},
   890  	{
   891  		Query:    `SELECT REGEXP_LIKE("xbc", "abc");`,
   892  		Expected: []sql.Row{{0}},
   893  	},
   894  	{
   895  		Query:    `SELECT REGEXP_LIKE("axc", "abc");`,
   896  		Expected: []sql.Row{{0}},
   897  	},
   898  	{
   899  		Query:    `SELECT REGEXP_LIKE("abx", "abc");`,
   900  		Expected: []sql.Row{{0}},
   901  	},
   902  	{
   903  		Query:    `SELECT REGEXP_LIKE("xabcy", "abc");`,
   904  		Expected: []sql.Row{{1}},
   905  	},
   906  	{
   907  		Query:    `SELECT REGEXP_LIKE("ababc", "abc");`,
   908  		Expected: []sql.Row{{1}},
   909  	},
   910  	{
   911  		Query:    `SELECT REGEXP_LIKE("abc", "ab*c");`,
   912  		Expected: []sql.Row{{1}},
   913  	},
   914  	{
   915  		Query:    `SELECT REGEXP_LIKE("abc", "ab*bc");`,
   916  		Expected: []sql.Row{{1}},
   917  	},
   918  	{
   919  		Query:    `SELECT REGEXP_LIKE("abbc", "ab*bc");`,
   920  		Expected: []sql.Row{{1}},
   921  	},
   922  	{
   923  		Query:    `SELECT REGEXP_LIKE("abbbbc", "ab*bc");`,
   924  		Expected: []sql.Row{{1}},
   925  	},
   926  	{
   927  		Query:    `SELECT REGEXP_LIKE("abbbbc", "ab{0,}bc");`,
   928  		Expected: []sql.Row{{1}},
   929  	},
   930  	{
   931  		Query:    `SELECT REGEXP_LIKE("abbc", "ab+bc");`,
   932  		Expected: []sql.Row{{1}},
   933  	},
   934  	{
   935  		Query:    `SELECT REGEXP_LIKE("abc", "ab+bc");`,
   936  		Expected: []sql.Row{{0}},
   937  	},
   938  	{
   939  		Query:    `SELECT REGEXP_LIKE("abq", "ab+bc");`,
   940  		Expected: []sql.Row{{0}},
   941  	},
   942  	{
   943  		Query:    `SELECT REGEXP_LIKE("abq", "ab{1,}bc");`,
   944  		Expected: []sql.Row{{0}},
   945  	},
   946  	{
   947  		Query:    `SELECT REGEXP_LIKE("abbbbc", "ab+bc");`,
   948  		Expected: []sql.Row{{1}},
   949  	},
   950  	{
   951  		Query:    `SELECT REGEXP_LIKE("abbbbc", "ab{1,}bc");`,
   952  		Expected: []sql.Row{{1}},
   953  	},
   954  	{
   955  		Query:    `SELECT REGEXP_LIKE("abbbbc", "ab{1,3}bc");`,
   956  		Expected: []sql.Row{{1}},
   957  	},
   958  	{
   959  		Query:    `SELECT REGEXP_LIKE("abbbbc", "ab{3,4}bc");`,
   960  		Expected: []sql.Row{{1}},
   961  	},
   962  	{
   963  		Query:    `SELECT REGEXP_LIKE("abbbbc", "ab{4,5}bc");`,
   964  		Expected: []sql.Row{{0}},
   965  	},
   966  	{
   967  		Query:    `SELECT REGEXP_LIKE("abbc", "ab?bc");`,
   968  		Expected: []sql.Row{{1}},
   969  	},
   970  	{
   971  		Query:    `SELECT REGEXP_LIKE("abc", "ab?bc");`,
   972  		Expected: []sql.Row{{1}},
   973  	},
   974  	{
   975  		Query:    `SELECT REGEXP_LIKE("abc", "ab{0,1}bc");`,
   976  		Expected: []sql.Row{{1}},
   977  	},
   978  	{
   979  		Query:    `SELECT REGEXP_LIKE("abbbbc", "ab?bc");`,
   980  		Expected: []sql.Row{{0}},
   981  	},
   982  	{
   983  		Query:    `SELECT REGEXP_LIKE("abc", "ab?c");`,
   984  		Expected: []sql.Row{{1}},
   985  	},
   986  	{
   987  		Query:    `SELECT REGEXP_LIKE("abc", "ab{0,1}c");`,
   988  		Expected: []sql.Row{{1}},
   989  	},
   990  	{
   991  		Query:    `SELECT REGEXP_LIKE("abc", "^abc$");`,
   992  		Expected: []sql.Row{{1}},
   993  	},
   994  	{
   995  		Query:    `SELECT REGEXP_LIKE("abcc", "^abc$");`,
   996  		Expected: []sql.Row{{0}},
   997  	},
   998  	{
   999  		Query:    `SELECT REGEXP_LIKE("abcc", "^abc");`,
  1000  		Expected: []sql.Row{{1}},
  1001  	},
  1002  	{
  1003  		Query:    `SELECT REGEXP_LIKE("aabc", "^abc$");`,
  1004  		Expected: []sql.Row{{0}},
  1005  	},
  1006  	{
  1007  		Query:    `SELECT REGEXP_LIKE("aabc", "abc$");`,
  1008  		Expected: []sql.Row{{1}},
  1009  	},
  1010  	{
  1011  		Query:    `SELECT REGEXP_LIKE("abc", "^");`,
  1012  		Expected: []sql.Row{{1}},
  1013  	},
  1014  	{
  1015  		Query:    `SELECT REGEXP_LIKE("abc", "$");`,
  1016  		Expected: []sql.Row{{1}},
  1017  	},
  1018  	{
  1019  		Query:    `SELECT REGEXP_LIKE("abc", "a.c");`,
  1020  		Expected: []sql.Row{{1}},
  1021  	},
  1022  	{
  1023  		Query:    `SELECT REGEXP_LIKE("axc", "a.c");`,
  1024  		Expected: []sql.Row{{1}},
  1025  	},
  1026  	{
  1027  		Query:    `SELECT REGEXP_LIKE("axyzc", "a.*c");`,
  1028  		Expected: []sql.Row{{1}},
  1029  	},
  1030  	{
  1031  		Query:    `SELECT REGEXP_LIKE("axyzd", "a.*c");`,
  1032  		Expected: []sql.Row{{0}},
  1033  	},
  1034  	{
  1035  		Query:    `SELECT REGEXP_LIKE("abc", "a[bc]d");`,
  1036  		Expected: []sql.Row{{0}},
  1037  	},
  1038  	{
  1039  		Query:    `SELECT REGEXP_LIKE("abd", "a[bc]d");`,
  1040  		Expected: []sql.Row{{1}},
  1041  	},
  1042  	{
  1043  		Query:    `SELECT REGEXP_LIKE("abd", "a[b-d]e");`,
  1044  		Expected: []sql.Row{{0}},
  1045  	},
  1046  	{
  1047  		Query:    `SELECT REGEXP_LIKE("ace", "a[b-d]e");`,
  1048  		Expected: []sql.Row{{1}},
  1049  	},
  1050  	{
  1051  		Query:    `SELECT REGEXP_LIKE("aac", "a[b-d]");`,
  1052  		Expected: []sql.Row{{1}},
  1053  	},
  1054  	{
  1055  		Query:    `SELECT REGEXP_LIKE("a-", "a[-b]");`,
  1056  		Expected: []sql.Row{{1}},
  1057  	},
  1058  	{
  1059  		Query:    `SELECT REGEXP_LIKE("a-", "a[b-]");`,
  1060  		Expected: []sql.Row{{1}},
  1061  	},
  1062  	{
  1063  		Query:       `SELECT REGEXP_LIKE("-", "a[b-a]");`,
  1064  		ExpectedErr: regex.ErrInvalidRegex,
  1065  	},
  1066  	{
  1067  		Query:       `SELECT REGEXP_LIKE("-", "a[]b");`,
  1068  		ExpectedErr: regex.ErrInvalidRegex,
  1069  	},
  1070  	{
  1071  		Query:       `SELECT REGEXP_LIKE("-", "a[");`,
  1072  		ExpectedErr: regex.ErrInvalidRegex,
  1073  	},
  1074  	{
  1075  		Query:    `SELECT REGEXP_LIKE("a]", "a]");`,
  1076  		Expected: []sql.Row{{1}},
  1077  	},
  1078  	{
  1079  		Query:    `SELECT REGEXP_LIKE("a]b", "a[]]b");`,
  1080  		Expected: []sql.Row{{1}},
  1081  	},
  1082  	{
  1083  		Query:    `SELECT REGEXP_LIKE("aed", "a[^bc]d");`,
  1084  		Expected: []sql.Row{{1}},
  1085  	},
  1086  	{
  1087  		Query:    `SELECT REGEXP_LIKE("abd", "a[^bc]d");`,
  1088  		Expected: []sql.Row{{0}},
  1089  	},
  1090  	{
  1091  		Query:    `SELECT REGEXP_LIKE("adc", "a[^-b]c");`,
  1092  		Expected: []sql.Row{{1}},
  1093  	},
  1094  	{
  1095  		Query:    `SELECT REGEXP_LIKE("a-c", "a[^-b]c");`,
  1096  		Expected: []sql.Row{{0}},
  1097  	},
  1098  	{
  1099  		Query:    `SELECT REGEXP_LIKE("a]c", "a[^]b]c");`,
  1100  		Expected: []sql.Row{{0}},
  1101  	},
  1102  	{
  1103  		Query:    `SELECT REGEXP_LIKE("adc", "a[^]b]c");`,
  1104  		Expected: []sql.Row{{1}},
  1105  	},
  1106  	{
  1107  		Query:    `SELECT REGEXP_LIKE("abc", "ab|cd");`,
  1108  		Expected: []sql.Row{{1}},
  1109  	},
  1110  	{
  1111  		Query:    `SELECT REGEXP_LIKE("abcd", "ab|cd");`,
  1112  		Expected: []sql.Row{{1}},
  1113  	},
  1114  	{
  1115  		Query:    `SELECT REGEXP_LIKE("def", "()ef");`,
  1116  		Expected: []sql.Row{{1}},
  1117  	},
  1118  	{
  1119  		Query:       `SELECT REGEXP_LIKE("-", "*a");`,
  1120  		ExpectedErr: regex.ErrInvalidRegex,
  1121  	},
  1122  	{
  1123  		Query:       `SELECT REGEXP_LIKE("-", "(*)b");`,
  1124  		ExpectedErr: regex.ErrInvalidRegex,
  1125  	},
  1126  	{
  1127  		Query:    `SELECT REGEXP_LIKE("b", "$b");`,
  1128  		Expected: []sql.Row{{0}},
  1129  	},
  1130  	{
  1131  		Query:       `SELECT REGEXP_LIKE("-", "a\\");`,
  1132  		ExpectedErr: regex.ErrInvalidRegex,
  1133  	},
  1134  	{
  1135  		Query:    `SELECT REGEXP_LIKE("a(b", "a\\(b");`,
  1136  		Expected: []sql.Row{{1}},
  1137  	},
  1138  	{
  1139  		Query:    `SELECT REGEXP_LIKE("ab", "a\\(*b");`,
  1140  		Expected: []sql.Row{{1}},
  1141  	},
  1142  	{
  1143  		Query:    `SELECT REGEXP_LIKE("a((b", "a\\(*b");`,
  1144  		Expected: []sql.Row{{1}},
  1145  	},
  1146  	{
  1147  		Query:    `SELECT REGEXP_LIKE("a\\b", "a\\\\b");`,
  1148  		Expected: []sql.Row{{1}},
  1149  	},
  1150  	{
  1151  		Query:       `SELECT REGEXP_LIKE("-", "abc)");`,
  1152  		ExpectedErr: regex.ErrInvalidRegex,
  1153  	},
  1154  	{
  1155  		Query:       `SELECT REGEXP_LIKE("-", "(abc");`,
  1156  		ExpectedErr: regex.ErrInvalidRegex,
  1157  	},
  1158  	{
  1159  		Query:    `SELECT REGEXP_LIKE("abc", "((a))");`,
  1160  		Expected: []sql.Row{{1}},
  1161  	},
  1162  	{
  1163  		Query:    `SELECT REGEXP_LIKE("abc", "(a)b(c)");`,
  1164  		Expected: []sql.Row{{1}},
  1165  	},
  1166  	{
  1167  		Query:    `SELECT REGEXP_LIKE("aabbabc", "a+b+c");`,
  1168  		Expected: []sql.Row{{1}},
  1169  	},
  1170  	{
  1171  		Query:    `SELECT REGEXP_LIKE("aabbabc", "a{1,}b{1,}c");`,
  1172  		Expected: []sql.Row{{1}},
  1173  	},
  1174  	{
  1175  		Query:       `SELECT REGEXP_LIKE("-", "a**");`,
  1176  		ExpectedErr: regex.ErrInvalidRegex,
  1177  	},
  1178  	{
  1179  		Query:    `SELECT REGEXP_LIKE("abcabc", "a.+?c");`,
  1180  		Expected: []sql.Row{{1}},
  1181  	},
  1182  	{
  1183  		Query:    `SELECT REGEXP_LIKE("ab", "(a+|b)*");`,
  1184  		Expected: []sql.Row{{1}},
  1185  	},
  1186  	{
  1187  		Query:    `SELECT REGEXP_LIKE("ab", "(a+|b){0,}");`,
  1188  		Expected: []sql.Row{{1}},
  1189  	},
  1190  	{
  1191  		Query:    `SELECT REGEXP_LIKE("ab", "(a+|b)+");`,
  1192  		Expected: []sql.Row{{1}},
  1193  	},
  1194  	{
  1195  		Query:    `SELECT REGEXP_LIKE("ab", "(a+|b){1,}");`,
  1196  		Expected: []sql.Row{{1}},
  1197  	},
  1198  	{
  1199  		Query:    `SELECT REGEXP_LIKE("ab", "(a+|b)?");`,
  1200  		Expected: []sql.Row{{1}},
  1201  	},
  1202  	{
  1203  		Query:    `SELECT REGEXP_LIKE("ab", "(a+|b){0,1}");`,
  1204  		Expected: []sql.Row{{1}},
  1205  	},
  1206  	{
  1207  		Query:       `SELECT REGEXP_LIKE("-", ")(");`,
  1208  		ExpectedErr: regex.ErrInvalidRegex,
  1209  	},
  1210  	{
  1211  		Query:    `SELECT REGEXP_LIKE("cde", "[^ab]*");`,
  1212  		Expected: []sql.Row{{1}},
  1213  	},
  1214  	{
  1215  		Query:    `SELECT REGEXP_LIKE("", "abc");`,
  1216  		Expected: []sql.Row{{0}},
  1217  	},
  1218  	{
  1219  		Query:    `SELECT REGEXP_LIKE("", "a*");`,
  1220  		Expected: []sql.Row{{1}},
  1221  	},
  1222  	{
  1223  		Query:    `SELECT REGEXP_LIKE("abbbcd", "([abc])*d");`,
  1224  		Expected: []sql.Row{{1}},
  1225  	},
  1226  	{
  1227  		Query:    `SELECT REGEXP_LIKE("abcd", "([abc])*bcd");`,
  1228  		Expected: []sql.Row{{1}},
  1229  	},
  1230  	{
  1231  		Query:    `SELECT REGEXP_LIKE("e", "a|b|c|d|e");`,
  1232  		Expected: []sql.Row{{1}},
  1233  	},
  1234  	{
  1235  		Query:    `SELECT REGEXP_LIKE("ef", "(a|b|c|d|e)f");`,
  1236  		Expected: []sql.Row{{1}},
  1237  	},
  1238  	{
  1239  		Query:    `SELECT REGEXP_LIKE("abcdefg", "abcd*efg");`,
  1240  		Expected: []sql.Row{{1}},
  1241  	},
  1242  	{
  1243  		Query:    `SELECT REGEXP_LIKE("xabyabbbz", "ab*");`,
  1244  		Expected: []sql.Row{{1}},
  1245  	},
  1246  	{
  1247  		Query:    `SELECT REGEXP_LIKE("xayabbbz", "ab*");`,
  1248  		Expected: []sql.Row{{1}},
  1249  	},
  1250  	{
  1251  		Query:    `SELECT REGEXP_LIKE("abcde", "(ab|cd)e");`,
  1252  		Expected: []sql.Row{{1}},
  1253  	},
  1254  	{
  1255  		Query:    `SELECT REGEXP_LIKE("hij", "[abhgefdc]ij");`,
  1256  		Expected: []sql.Row{{1}},
  1257  	},
  1258  	{
  1259  		Query:    `SELECT REGEXP_LIKE("abcde", "^(ab|cd)e");`,
  1260  		Expected: []sql.Row{{0}},
  1261  	},
  1262  	{
  1263  		Query:    `SELECT REGEXP_LIKE("abcdef", "(abc|)ef");`,
  1264  		Expected: []sql.Row{{1}},
  1265  	},
  1266  	{
  1267  		Query:    `SELECT REGEXP_LIKE("abcd", "(a|b)c*d");`,
  1268  		Expected: []sql.Row{{1}},
  1269  	},
  1270  	{
  1271  		Query:    `SELECT REGEXP_LIKE("abc", "(ab|ab*)bc");`,
  1272  		Expected: []sql.Row{{1}},
  1273  	},
  1274  	{
  1275  		Query:    `SELECT REGEXP_LIKE("abc", "a([bc]*)c*");`,
  1276  		Expected: []sql.Row{{1}},
  1277  	},
  1278  	{
  1279  		Query:    `SELECT REGEXP_LIKE("abcd", "a([bc]*)(c*d)");`,
  1280  		Expected: []sql.Row{{1}},
  1281  	},
  1282  	{
  1283  		Query:    `SELECT REGEXP_LIKE("abcd", "a([bc]+)(c*d)");`,
  1284  		Expected: []sql.Row{{1}},
  1285  	},
  1286  	{
  1287  		Query:    `SELECT REGEXP_LIKE("abcd", "a([bc]*)(c+d)");`,
  1288  		Expected: []sql.Row{{1}},
  1289  	},
  1290  	{
  1291  		Query:    `SELECT REGEXP_LIKE("adcdcde", "a[bcd]*dcdcde");`,
  1292  		Expected: []sql.Row{{1}},
  1293  	},
  1294  	{
  1295  		Query:    `SELECT REGEXP_LIKE("adcdcde", "a[bcd]+dcdcde");`,
  1296  		Expected: []sql.Row{{0}},
  1297  	},
  1298  	{
  1299  		Query:    `SELECT REGEXP_LIKE("abc", "(ab|a)b*c");`,
  1300  		Expected: []sql.Row{{1}},
  1301  	},
  1302  	{
  1303  		Query:    `SELECT REGEXP_LIKE("abcd", "((a)(b)c)(d)");`,
  1304  		Expected: []sql.Row{{1}},
  1305  	},
  1306  	{
  1307  		Query:    `SELECT REGEXP_LIKE("alpha", "[a-zA-Z_][a-zA-Z0-9_]*");`,
  1308  		Expected: []sql.Row{{1}},
  1309  	},
  1310  	{
  1311  		Query:    `SELECT REGEXP_LIKE("abh", "^a(bc+|b[eh])g|.h$");`,
  1312  		Expected: []sql.Row{{1}},
  1313  	},
  1314  	{
  1315  		Query:    `SELECT REGEXP_LIKE("effgz", "(bc+d$|ef*g.|h?i(j|k))");`,
  1316  		Expected: []sql.Row{{1}},
  1317  	},
  1318  	{
  1319  		Query:    `SELECT REGEXP_LIKE("ij", "(bc+d$|ef*g.|h?i(j|k))");`,
  1320  		Expected: []sql.Row{{1}},
  1321  	},
  1322  	{
  1323  		Query:    `SELECT REGEXP_LIKE("effg", "(bc+d$|ef*g.|h?i(j|k))");`,
  1324  		Expected: []sql.Row{{0}},
  1325  	},
  1326  	{
  1327  		Query:    `SELECT REGEXP_LIKE("bcdd", "(bc+d$|ef*g.|h?i(j|k))");`,
  1328  		Expected: []sql.Row{{0}},
  1329  	},
  1330  	{
  1331  		Query:    `SELECT REGEXP_LIKE("reffgz", "(bc+d$|ef*g.|h?i(j|k))");`,
  1332  		Expected: []sql.Row{{1}},
  1333  	},
  1334  	{
  1335  		Query:    `SELECT REGEXP_LIKE("a", "((((((((((a))))))))))");`,
  1336  		Expected: []sql.Row{{1}},
  1337  	},
  1338  	{
  1339  		Query:    `SELECT REGEXP_LIKE("aa", "((((((((((a))))))))))\\10");`,
  1340  		Expected: []sql.Row{{1}},
  1341  	},
  1342  	{
  1343  		Query:       `SELECT REGEXP_LIKE("", "((((((((((a))))))))))\\41");`,
  1344  		ExpectedErr: regex.ErrInvalidRegex,
  1345  	},
  1346  	{
  1347  		Query:       `SELECT REGEXP_LIKE("", "(?i)((((((((((a))))))))))\\41");`,
  1348  		ExpectedErr: regex.ErrInvalidRegex,
  1349  	},
  1350  	{
  1351  		Query:    `SELECT REGEXP_LIKE("a", "(((((((((a)))))))))");`,
  1352  		Expected: []sql.Row{{1}},
  1353  	},
  1354  	{
  1355  		Query:    `SELECT REGEXP_LIKE("uh-uh", "multiple words of text");`,
  1356  		Expected: []sql.Row{{0}},
  1357  	},
  1358  	{
  1359  		Query:    `SELECT REGEXP_LIKE("multiple words, yeah", "multiple words");`,
  1360  		Expected: []sql.Row{{1}},
  1361  	},
  1362  	{
  1363  		Query:    `SELECT REGEXP_LIKE("abcde", "(.*)c(.*)");`,
  1364  		Expected: []sql.Row{{1}},
  1365  	},
  1366  	{
  1367  		Query:    `SELECT REGEXP_LIKE("(a, b)", "\\((.*), (.*)\\)");`,
  1368  		Expected: []sql.Row{{1}},
  1369  	},
  1370  	{
  1371  		Query:    `SELECT REGEXP_LIKE("ab", "[k]");`,
  1372  		Expected: []sql.Row{{0}},
  1373  	},
  1374  	{
  1375  		Query:    `SELECT REGEXP_LIKE("ac", "a[-]?c");`,
  1376  		Expected: []sql.Row{{1}},
  1377  	},
  1378  	{
  1379  		Query:    `SELECT REGEXP_LIKE("abcabc", "(abc)\\1");`,
  1380  		Expected: []sql.Row{{1}},
  1381  	},
  1382  	{
  1383  		Query:    `SELECT REGEXP_LIKE("abcabc", "([a-c]*)\\1");`,
  1384  		Expected: []sql.Row{{1}},
  1385  	},
  1386  	{
  1387  		Query:    `SELECT REGEXP_LIKE("ABC", "(?i)abc");`,
  1388  		Expected: []sql.Row{{1}},
  1389  	},
  1390  	{
  1391  		Query:    `SELECT REGEXP_LIKE("XBC", "(?i)abc");`,
  1392  		Expected: []sql.Row{{0}},
  1393  	},
  1394  	{
  1395  		Query:    `SELECT REGEXP_LIKE("AXC", "(?i)abc");`,
  1396  		Expected: []sql.Row{{0}},
  1397  	},
  1398  	{
  1399  		Query:    `SELECT REGEXP_LIKE("ABX", "(?i)abc");`,
  1400  		Expected: []sql.Row{{0}},
  1401  	},
  1402  	{
  1403  		Query:    `SELECT REGEXP_LIKE("XABCY", "(?i)abc");`,
  1404  		Expected: []sql.Row{{1}},
  1405  	},
  1406  	{
  1407  		Query:    `SELECT REGEXP_LIKE("ABABC", "(?i)abc");`,
  1408  		Expected: []sql.Row{{1}},
  1409  	},
  1410  	{
  1411  		Query:    `SELECT REGEXP_LIKE("ABC", "(?i)ab*c");`,
  1412  		Expected: []sql.Row{{1}},
  1413  	},
  1414  	{
  1415  		Query:    `SELECT REGEXP_LIKE("ABC", "(?i)ab*bc");`,
  1416  		Expected: []sql.Row{{1}},
  1417  	},
  1418  	{
  1419  		Query:    `SELECT REGEXP_LIKE("ABBC", "(?i)ab*bc");`,
  1420  		Expected: []sql.Row{{1}},
  1421  	},
  1422  	{
  1423  		Query:    `SELECT REGEXP_LIKE("ABBBBC", "(?i)ab*?bc");`,
  1424  		Expected: []sql.Row{{1}},
  1425  	},
  1426  	{
  1427  		Query:    `SELECT REGEXP_LIKE("ABBBBC", "(?i)ab{0,}?bc");`,
  1428  		Expected: []sql.Row{{1}},
  1429  	},
  1430  	{
  1431  		Query:    `SELECT REGEXP_LIKE("ABBC", "(?i)ab+?bc");`,
  1432  		Expected: []sql.Row{{1}},
  1433  	},
  1434  	{
  1435  		Query:    `SELECT REGEXP_LIKE("ABC", "(?i)ab+bc");`,
  1436  		Expected: []sql.Row{{0}},
  1437  	},
  1438  	{
  1439  		Query:    `SELECT REGEXP_LIKE("ABQ", "(?i)ab+bc");`,
  1440  		Expected: []sql.Row{{0}},
  1441  	},
  1442  	{
  1443  		Query:    `SELECT REGEXP_LIKE("ABQ", "(?i)ab{1,}bc");`,
  1444  		Expected: []sql.Row{{0}},
  1445  	},
  1446  	{
  1447  		Query:    `SELECT REGEXP_LIKE("ABBBBC", "(?i)ab+bc");`,
  1448  		Expected: []sql.Row{{1}},
  1449  	},
  1450  	{
  1451  		Query:    `SELECT REGEXP_LIKE("ABBBBC", "(?i)ab{1,}?bc");`,
  1452  		Expected: []sql.Row{{1}},
  1453  	},
  1454  	{
  1455  		Query:    `SELECT REGEXP_LIKE("ABBBBC", "(?i)ab{1,3}?bc");`,
  1456  		Expected: []sql.Row{{1}},
  1457  	},
  1458  	{
  1459  		Query:    `SELECT REGEXP_LIKE("ABBBBC", "(?i)ab{3,4}?bc");`,
  1460  		Expected: []sql.Row{{1}},
  1461  	},
  1462  	{
  1463  		Query:    `SELECT REGEXP_LIKE("ABBBBC", "(?i)ab{4,5}?bc");`,
  1464  		Expected: []sql.Row{{0}},
  1465  	},
  1466  	{
  1467  		Query:    `SELECT REGEXP_LIKE("ABBC", "(?i)ab??bc");`,
  1468  		Expected: []sql.Row{{1}},
  1469  	},
  1470  	{
  1471  		Query:    `SELECT REGEXP_LIKE("ABC", "(?i)ab??bc");`,
  1472  		Expected: []sql.Row{{1}},
  1473  	},
  1474  	{
  1475  		Query:    `SELECT REGEXP_LIKE("ABC", "(?i)ab{0,1}?bc");`,
  1476  		Expected: []sql.Row{{1}},
  1477  	},
  1478  	{
  1479  		Query:    `SELECT REGEXP_LIKE("ABBBBC", "(?i)ab??bc");`,
  1480  		Expected: []sql.Row{{0}},
  1481  	},
  1482  	{
  1483  		Query:    `SELECT REGEXP_LIKE("ABC", "(?i)ab??c");`,
  1484  		Expected: []sql.Row{{1}},
  1485  	},
  1486  	{
  1487  		Query:    `SELECT REGEXP_LIKE("ABC", "(?i)ab{0,1}?c");`,
  1488  		Expected: []sql.Row{{1}},
  1489  	},
  1490  	{
  1491  		Query:    `SELECT REGEXP_LIKE("ABC", "(?i)^abc$");`,
  1492  		Expected: []sql.Row{{1}},
  1493  	},
  1494  	{
  1495  		Query:    `SELECT REGEXP_LIKE("ABCC", "(?i)^abc$");`,
  1496  		Expected: []sql.Row{{0}},
  1497  	},
  1498  	{
  1499  		Query:    `SELECT REGEXP_LIKE("ABCC", "(?i)^abc");`,
  1500  		Expected: []sql.Row{{1}},
  1501  	},
  1502  	{
  1503  		Query:    `SELECT REGEXP_LIKE("AABC", "(?i)^abc$");`,
  1504  		Expected: []sql.Row{{0}},
  1505  	},
  1506  	{
  1507  		Query:    `SELECT REGEXP_LIKE("AABC", "(?i)abc$");`,
  1508  		Expected: []sql.Row{{1}},
  1509  	},
  1510  	{
  1511  		Query:    `SELECT REGEXP_LIKE("ABC", "(?i)^");`,
  1512  		Expected: []sql.Row{{1}},
  1513  	},
  1514  	{
  1515  		Query:    `SELECT REGEXP_LIKE("ABC", "(?i)$");`,
  1516  		Expected: []sql.Row{{1}},
  1517  	},
  1518  	{
  1519  		Query:    `SELECT REGEXP_LIKE("ABC", "(?i)a.c");`,
  1520  		Expected: []sql.Row{{1}},
  1521  	},
  1522  	{
  1523  		Query:    `SELECT REGEXP_LIKE("AXC", "(?i)a.c");`,
  1524  		Expected: []sql.Row{{1}},
  1525  	},
  1526  	{
  1527  		Query:    `SELECT REGEXP_LIKE("AXYZC", "(?i)a.*?c");`,
  1528  		Expected: []sql.Row{{1}},
  1529  	},
  1530  	{
  1531  		Query:    `SELECT REGEXP_LIKE("AXYZD", "(?i)a.*c");`,
  1532  		Expected: []sql.Row{{0}},
  1533  	},
  1534  	{
  1535  		Query:    `SELECT REGEXP_LIKE("ABC", "(?i)a[bc]d");`,
  1536  		Expected: []sql.Row{{0}},
  1537  	},
  1538  	{
  1539  		Query:    `SELECT REGEXP_LIKE("ABD", "(?i)a[bc]d");`,
  1540  		Expected: []sql.Row{{1}},
  1541  	},
  1542  	{
  1543  		Query:    `SELECT REGEXP_LIKE("ABD", "(?i)a[b-d]e");`,
  1544  		Expected: []sql.Row{{0}},
  1545  	},
  1546  	{
  1547  		Query:    `SELECT REGEXP_LIKE("ACE", "(?i)a[b-d]e");`,
  1548  		Expected: []sql.Row{{1}},
  1549  	},
  1550  	{
  1551  		Query:    `SELECT REGEXP_LIKE("AAC", "(?i)a[b-d]");`,
  1552  		Expected: []sql.Row{{1}},
  1553  	},
  1554  	{
  1555  		Query:    `SELECT REGEXP_LIKE("A-", "(?i)a[-b]");`,
  1556  		Expected: []sql.Row{{1}},
  1557  	},
  1558  	{
  1559  		Query:    `SELECT REGEXP_LIKE("A-", "(?i)a[b-]");`,
  1560  		Expected: []sql.Row{{1}},
  1561  	},
  1562  	{
  1563  		Query:       `SELECT REGEXP_LIKE("-", "(?i)a[b-a]");`,
  1564  		ExpectedErr: regex.ErrInvalidRegex,
  1565  	},
  1566  	{
  1567  		Query:       `SELECT REGEXP_LIKE("-", "(?i)a[]b");`,
  1568  		ExpectedErr: regex.ErrInvalidRegex,
  1569  	},
  1570  	{
  1571  		Query:       `SELECT REGEXP_LIKE("-", "(?i)a[");`,
  1572  		ExpectedErr: regex.ErrInvalidRegex,
  1573  	},
  1574  	{
  1575  		Query:    `SELECT REGEXP_LIKE("A]", "(?i)a]");`,
  1576  		Expected: []sql.Row{{1}},
  1577  	},
  1578  	{
  1579  		Query:    `SELECT REGEXP_LIKE("A]B", "(?i)a[]]b");`,
  1580  		Expected: []sql.Row{{1}},
  1581  	},
  1582  	{
  1583  		Query:    `SELECT REGEXP_LIKE("AED", "(?i)a[^bc]d");`,
  1584  		Expected: []sql.Row{{1}},
  1585  	},
  1586  	{
  1587  		Query:    `SELECT REGEXP_LIKE("ABD", "(?i)a[^bc]d");`,
  1588  		Expected: []sql.Row{{0}},
  1589  	},
  1590  	{
  1591  		Query:    `SELECT REGEXP_LIKE("ADC", "(?i)a[^-b]c");`,
  1592  		Expected: []sql.Row{{1}},
  1593  	},
  1594  	{
  1595  		Query:    `SELECT REGEXP_LIKE("A-C", "(?i)a[^-b]c");`,
  1596  		Expected: []sql.Row{{0}},
  1597  	},
  1598  	{
  1599  		Query:    `SELECT REGEXP_LIKE("A]C", "(?i)a[^]b]c");`,
  1600  		Expected: []sql.Row{{0}},
  1601  	},
  1602  	{
  1603  		Query:    `SELECT REGEXP_LIKE("ADC", "(?i)a[^]b]c");`,
  1604  		Expected: []sql.Row{{1}},
  1605  	},
  1606  	{
  1607  		Query:    `SELECT REGEXP_LIKE("ABC", "(?i)ab|cd");`,
  1608  		Expected: []sql.Row{{1}},
  1609  	},
  1610  	{
  1611  		Query:    `SELECT REGEXP_LIKE("ABCD", "(?i)ab|cd");`,
  1612  		Expected: []sql.Row{{1}},
  1613  	},
  1614  	{
  1615  		Query:    `SELECT REGEXP_LIKE("DEF", "(?i)()ef");`,
  1616  		Expected: []sql.Row{{1}},
  1617  	},
  1618  	{
  1619  		Query:       `SELECT REGEXP_LIKE("-", "(?i)*a");`,
  1620  		ExpectedErr: regex.ErrInvalidRegex,
  1621  	},
  1622  	{
  1623  		Query:       `SELECT REGEXP_LIKE("-", "(?i)(*)b");`,
  1624  		ExpectedErr: regex.ErrInvalidRegex,
  1625  	},
  1626  	{
  1627  		Query:    `SELECT REGEXP_LIKE("B", "(?i)$b");`,
  1628  		Expected: []sql.Row{{0}},
  1629  	},
  1630  	{
  1631  		Query:       `SELECT REGEXP_LIKE("-", "(?i)a\\");`,
  1632  		ExpectedErr: regex.ErrInvalidRegex,
  1633  	},
  1634  	{
  1635  		Query:    `SELECT REGEXP_LIKE("A(B", "(?i)a\\(b");`,
  1636  		Expected: []sql.Row{{1}},
  1637  	},
  1638  	{
  1639  		Query:    `SELECT REGEXP_LIKE("AB", "(?i)a\\(*b");`,
  1640  		Expected: []sql.Row{{1}},
  1641  	},
  1642  	{
  1643  		Query:    `SELECT REGEXP_LIKE("A((B", "(?i)a\\(*b");`,
  1644  		Expected: []sql.Row{{1}},
  1645  	},
  1646  	{
  1647  		Query:    `SELECT REGEXP_LIKE("A\\B", "(?i)a\\\\b");`,
  1648  		Expected: []sql.Row{{1}},
  1649  	},
  1650  	{
  1651  		Query:       `SELECT REGEXP_LIKE("-", "(?i)abc)");`,
  1652  		ExpectedErr: regex.ErrInvalidRegex,
  1653  	},
  1654  	{
  1655  		Query:       `SELECT REGEXP_LIKE("-", "(?i)(abc");`,
  1656  		ExpectedErr: regex.ErrInvalidRegex,
  1657  	},
  1658  	{
  1659  		Query:    `SELECT REGEXP_LIKE("ABC", "(?i)((a))");`,
  1660  		Expected: []sql.Row{{1}},
  1661  	},
  1662  	{
  1663  		Query:    `SELECT REGEXP_LIKE("ABC", "(?i)(a)b(c)");`,
  1664  		Expected: []sql.Row{{1}},
  1665  	},
  1666  	{
  1667  		Query:    `SELECT REGEXP_LIKE("AABBABC", "(?i)a+b+c");`,
  1668  		Expected: []sql.Row{{1}},
  1669  	},
  1670  	{
  1671  		Query:    `SELECT REGEXP_LIKE("AABBABC", "(?i)a{1,}b{1,}c");`,
  1672  		Expected: []sql.Row{{1}},
  1673  	},
  1674  	{
  1675  		Query:       `SELECT REGEXP_LIKE("-", "(?i)a**");`,
  1676  		ExpectedErr: regex.ErrInvalidRegex,
  1677  	},
  1678  	{
  1679  		Query:    `SELECT REGEXP_LIKE("ABCABC", "(?i)a.+?c");`,
  1680  		Expected: []sql.Row{{1}},
  1681  	},
  1682  	{
  1683  		Query:    `SELECT REGEXP_LIKE("ABCABC", "(?i)a.*?c");`,
  1684  		Expected: []sql.Row{{1}},
  1685  	},
  1686  	{
  1687  		Query:    `SELECT REGEXP_LIKE("ABCABC", "(?i)a.{0,5}?c");`,
  1688  		Expected: []sql.Row{{1}},
  1689  	},
  1690  	{
  1691  		Query:    `SELECT REGEXP_LIKE("AB", "(?i)(a+|b)*");`,
  1692  		Expected: []sql.Row{{1}},
  1693  	},
  1694  	{
  1695  		Query:    `SELECT REGEXP_LIKE("AB", "(?i)(a+|b){0,}");`,
  1696  		Expected: []sql.Row{{1}},
  1697  	},
  1698  	{
  1699  		Query:    `SELECT REGEXP_LIKE("AB", "(?i)(a+|b)+");`,
  1700  		Expected: []sql.Row{{1}},
  1701  	},
  1702  	{
  1703  		Query:    `SELECT REGEXP_LIKE("AB", "(?i)(a+|b){1,}");`,
  1704  		Expected: []sql.Row{{1}},
  1705  	},
  1706  	{
  1707  		Query:    `SELECT REGEXP_LIKE("AB", "(?i)(a+|b)?");`,
  1708  		Expected: []sql.Row{{1}},
  1709  	},
  1710  	{
  1711  		Query:    `SELECT REGEXP_LIKE("AB", "(?i)(a+|b){0,1}");`,
  1712  		Expected: []sql.Row{{1}},
  1713  	},
  1714  	{
  1715  		Query:    `SELECT REGEXP_LIKE("AB", "(?i)(a+|b){0,1}?");`,
  1716  		Expected: []sql.Row{{1}},
  1717  	},
  1718  	{
  1719  		Query:       `SELECT REGEXP_LIKE("-", "(?i))(");`,
  1720  		ExpectedErr: regex.ErrInvalidRegex,
  1721  	},
  1722  	{
  1723  		Query:    `SELECT REGEXP_LIKE("CDE", "(?i)[^ab]*");`,
  1724  		Expected: []sql.Row{{1}},
  1725  	},
  1726  	{
  1727  		Query:    `SELECT REGEXP_LIKE("", "(?i)abc");`,
  1728  		Expected: []sql.Row{{0}},
  1729  	},
  1730  	{
  1731  		Query:    `SELECT REGEXP_LIKE("", "(?i)a*");`,
  1732  		Expected: []sql.Row{{1}},
  1733  	},
  1734  	{
  1735  		Query:    `SELECT REGEXP_LIKE("ABBBCD", "(?i)([abc])*d");`,
  1736  		Expected: []sql.Row{{1}},
  1737  	},
  1738  	{
  1739  		Query:    `SELECT REGEXP_LIKE("ABCD", "(?i)([abc])*bcd");`,
  1740  		Expected: []sql.Row{{1}},
  1741  	},
  1742  	{
  1743  		Query:    `SELECT REGEXP_LIKE("E", "(?i)a|b|c|d|e");`,
  1744  		Expected: []sql.Row{{1}},
  1745  	},
  1746  	{
  1747  		Query:    `SELECT REGEXP_LIKE("EF", "(?i)(a|b|c|d|e)f");`,
  1748  		Expected: []sql.Row{{1}},
  1749  	},
  1750  	{
  1751  		Query:    `SELECT REGEXP_LIKE("ABCDEFG", "(?i)abcd*efg");`,
  1752  		Expected: []sql.Row{{1}},
  1753  	},
  1754  	{
  1755  		Query:    `SELECT REGEXP_LIKE("XABYABBBZ", "(?i)ab*");`,
  1756  		Expected: []sql.Row{{1}},
  1757  	},
  1758  	{
  1759  		Query:    `SELECT REGEXP_LIKE("XAYABBBZ", "(?i)ab*");`,
  1760  		Expected: []sql.Row{{1}},
  1761  	},
  1762  	{
  1763  		Query:    `SELECT REGEXP_LIKE("ABCDE", "(?i)(ab|cd)e");`,
  1764  		Expected: []sql.Row{{1}},
  1765  	},
  1766  	{
  1767  		Query:    `SELECT REGEXP_LIKE("HIJ", "(?i)[abhgefdc]ij");`,
  1768  		Expected: []sql.Row{{1}},
  1769  	},
  1770  	{
  1771  		Query:    `SELECT REGEXP_LIKE("ABCDE", "(?i)^(ab|cd)e");`,
  1772  		Expected: []sql.Row{{0}},
  1773  	},
  1774  	{
  1775  		Query:    `SELECT REGEXP_LIKE("ABCDEF", "(?i)(abc|)ef");`,
  1776  		Expected: []sql.Row{{1}},
  1777  	},
  1778  	{
  1779  		Query:    `SELECT REGEXP_LIKE("ABCD", "(?i)(a|b)c*d");`,
  1780  		Expected: []sql.Row{{1}},
  1781  	},
  1782  	{
  1783  		Query:    `SELECT REGEXP_LIKE("ABC", "(?i)(ab|ab*)bc");`,
  1784  		Expected: []sql.Row{{1}},
  1785  	},
  1786  	{
  1787  		Query:    `SELECT REGEXP_LIKE("ABC", "(?i)a([bc]*)c*");`,
  1788  		Expected: []sql.Row{{1}},
  1789  	},
  1790  	{
  1791  		Query:    `SELECT REGEXP_LIKE("ABCD", "(?i)a([bc]*)(c*d)");`,
  1792  		Expected: []sql.Row{{1}},
  1793  	},
  1794  	{
  1795  		Query:    `SELECT REGEXP_LIKE("ABCD", "(?i)a([bc]+)(c*d)");`,
  1796  		Expected: []sql.Row{{1}},
  1797  	},
  1798  	{
  1799  		Query:    `SELECT REGEXP_LIKE("ABCD", "(?i)a([bc]*)(c+d)");`,
  1800  		Expected: []sql.Row{{1}},
  1801  	},
  1802  	{
  1803  		Query:    `SELECT REGEXP_LIKE("ADCDCDE", "(?i)a[bcd]*dcdcde");`,
  1804  		Expected: []sql.Row{{1}},
  1805  	},
  1806  	{
  1807  		Query:    `SELECT REGEXP_LIKE("ADCDCDE", "(?i)a[bcd]+dcdcde");`,
  1808  		Expected: []sql.Row{{0}},
  1809  	},
  1810  	{
  1811  		Query:    `SELECT REGEXP_LIKE("ABC", "(?i)(ab|a)b*c");`,
  1812  		Expected: []sql.Row{{1}},
  1813  	},
  1814  	{
  1815  		Query:    `SELECT REGEXP_LIKE("ABCD", "(?i)((a)(b)c)(d)");`,
  1816  		Expected: []sql.Row{{1}},
  1817  	},
  1818  	{
  1819  		Query:    `SELECT REGEXP_LIKE("ALPHA", "(?i)[a-zA-Z_][a-zA-Z0-9_]*");`,
  1820  		Expected: []sql.Row{{1}},
  1821  	},
  1822  	{
  1823  		Query:    `SELECT REGEXP_LIKE("ABH", "(?i)^a(bc+|b[eh])g|.h$");`,
  1824  		Expected: []sql.Row{{1}},
  1825  	},
  1826  	{
  1827  		Query:    `SELECT REGEXP_LIKE("EFFGZ", "(?i)(bc+d$|ef*g.|h?i(j|k))");`,
  1828  		Expected: []sql.Row{{1}},
  1829  	},
  1830  	{
  1831  		Query:    `SELECT REGEXP_LIKE("IJ", "(?i)(bc+d$|ef*g.|h?i(j|k))");`,
  1832  		Expected: []sql.Row{{1}},
  1833  	},
  1834  	{
  1835  		Query:    `SELECT REGEXP_LIKE("EFFG", "(?i)(bc+d$|ef*g.|h?i(j|k))");`,
  1836  		Expected: []sql.Row{{0}},
  1837  	},
  1838  	{
  1839  		Query:    `SELECT REGEXP_LIKE("BCDD", "(?i)(bc+d$|ef*g.|h?i(j|k))");`,
  1840  		Expected: []sql.Row{{0}},
  1841  	},
  1842  	{
  1843  		Query:    `SELECT REGEXP_LIKE("REFFGZ", "(?i)(bc+d$|ef*g.|h?i(j|k))");`,
  1844  		Expected: []sql.Row{{1}},
  1845  	},
  1846  	{
  1847  		Query:    `SELECT REGEXP_LIKE("A", "(?i)((((((((((a))))))))))");`,
  1848  		Expected: []sql.Row{{1}},
  1849  	},
  1850  	{
  1851  		Query:    `SELECT REGEXP_LIKE("AA", "(?i)((((((((((a))))))))))\\10");`,
  1852  		Expected: []sql.Row{{1}},
  1853  	},
  1854  	{
  1855  		Query:    `SELECT REGEXP_LIKE("A", "(?i)(((((((((a)))))))))");`,
  1856  		Expected: []sql.Row{{1}},
  1857  	},
  1858  	{
  1859  		Query:    `SELECT REGEXP_LIKE("A", "(?i)(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))");`,
  1860  		Expected: []sql.Row{{1}},
  1861  	},
  1862  	{
  1863  		Query:    `SELECT REGEXP_LIKE("C", "(?i)(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))");`,
  1864  		Expected: []sql.Row{{1}},
  1865  	},
  1866  	{
  1867  		Query:    `SELECT REGEXP_LIKE("UH-UH", "(?i)multiple words of text");`,
  1868  		Expected: []sql.Row{{0}},
  1869  	},
  1870  	{
  1871  		Query:    `SELECT REGEXP_LIKE("MULTIPLE WORDS, YEAH", "(?i)multiple words");`,
  1872  		Expected: []sql.Row{{1}},
  1873  	},
  1874  	{
  1875  		Query:    `SELECT REGEXP_LIKE("ABCDE", "(?i)(.*)c(.*)");`,
  1876  		Expected: []sql.Row{{1}},
  1877  	},
  1878  	{
  1879  		Query:    `SELECT REGEXP_LIKE("(A, B)", "(?i)\\((.*), (.*)\\)");`,
  1880  		Expected: []sql.Row{{1}},
  1881  	},
  1882  	{
  1883  		Query:    `SELECT REGEXP_LIKE("AB", "(?i)[k]");`,
  1884  		Expected: []sql.Row{{0}},
  1885  	},
  1886  	{
  1887  		Query:    `SELECT REGEXP_LIKE("AC", "(?i)a[-]?c");`,
  1888  		Expected: []sql.Row{{1}},
  1889  	},
  1890  	{
  1891  		Query:    `SELECT REGEXP_LIKE("ABCABC", "(?i)(abc)\\1");`,
  1892  		Expected: []sql.Row{{1}},
  1893  	},
  1894  	{
  1895  		Query:    `SELECT REGEXP_LIKE("ABCABC", "(?i)([a-c]*)\\1");`,
  1896  		Expected: []sql.Row{{1}},
  1897  	},
  1898  	{
  1899  		Query:    `SELECT REGEXP_LIKE("abad", "a(?!b).");`,
  1900  		Expected: []sql.Row{{1}},
  1901  	},
  1902  	{
  1903  		Query:    `SELECT REGEXP_LIKE("abad", "a(?=d).");`,
  1904  		Expected: []sql.Row{{1}},
  1905  	},
  1906  	{
  1907  		Query:    `SELECT REGEXP_LIKE("abad", "a(?=c|d).");`,
  1908  		Expected: []sql.Row{{1}},
  1909  	},
  1910  	{
  1911  		Query:    `SELECT REGEXP_LIKE("ace", "a(?:b|c|d)(.)");`,
  1912  		Expected: []sql.Row{{1}},
  1913  	},
  1914  	{
  1915  		Query:    `SELECT REGEXP_LIKE("ace", "a(?:b|c|d)*(.)");`,
  1916  		Expected: []sql.Row{{1}},
  1917  	},
  1918  	{
  1919  		Query:    `SELECT REGEXP_LIKE("ace", "a(?:b|c|d)+?(.)");`,
  1920  		Expected: []sql.Row{{1}},
  1921  	},
  1922  	{
  1923  		Query:    `SELECT REGEXP_LIKE("ace", "a(?:b|(c|e){1,2}?|d)+?(.)");`,
  1924  		Expected: []sql.Row{{1}},
  1925  	},
  1926  	{
  1927  		Query:    `SELECT REGEXP_LIKE("AB", "^(.+)?B");`,
  1928  		Expected: []sql.Row{{1}},
  1929  	},
  1930  	{
  1931  		Query:    `SELECT REGEXP_LIKE("a:bc-:de:f", "(?<!-):(.*?)(?<!-):");`,
  1932  		Expected: []sql.Row{{1}},
  1933  	},
  1934  	{
  1935  		Query:    `SELECT REGEXP_LIKE("a:bc\\:de:f", "(?<!\\\\):(.*?)(?<!\\\\):");`,
  1936  		Expected: []sql.Row{{1}},
  1937  	},
  1938  	{
  1939  		Query:    `SELECT REGEXP_LIKE("a'bc?'de'f", "(?<!\\?)'(.*?)(?<!\\?)'");`,
  1940  		Expected: []sql.Row{{1}},
  1941  	},
  1942  	{
  1943  		Query:       `SELECT REGEXP_LIKE("w", "w(?# comment");`,
  1944  		ExpectedErr: regex.ErrInvalidRegex,
  1945  	},
  1946  	{
  1947  		Query:    `SELECT REGEXP_LIKE("wxyz", "w(?# comment 1)xy(?# comment 2)z");`,
  1948  		Expected: []sql.Row{{1}},
  1949  	},
  1950  	{
  1951  		Query:    `SELECT REGEXP_LIKE("W", "(?i)w");`,
  1952  		Expected: []sql.Row{{1}},
  1953  	},
  1954  	{
  1955  		Query:    `SELECT REGEXP_LIKE("a\nb", "a.b");`,
  1956  		Expected: []sql.Row{{0}},
  1957  	},
  1958  	{
  1959  		Query:    `SELECT REGEXP_LIKE("a\nb", "(?s)a.b");`,
  1960  		Expected: []sql.Row{{1}},
  1961  	},
  1962  	{
  1963  		Query:    `SELECT REGEXP_LIKE("--ab_cd0123--", "\\w+");`,
  1964  		Expected: []sql.Row{{1}},
  1965  	},
  1966  	{
  1967  		Query:    `SELECT REGEXP_LIKE("--ab_cd0123--", "[\\w]+");`,
  1968  		Expected: []sql.Row{{1}},
  1969  	},
  1970  	{
  1971  		Query:    `SELECT REGEXP_LIKE("1234abc5678", "\\D+");`,
  1972  		Expected: []sql.Row{{1}},
  1973  	},
  1974  	{
  1975  		Query:    `SELECT REGEXP_LIKE("1234abc5678", "[\\D]+");`,
  1976  		Expected: []sql.Row{{1}},
  1977  	},
  1978  	{
  1979  		Query:    `SELECT REGEXP_LIKE("123abc", "[\\da-fA-F]+");`,
  1980  		Expected: []sql.Row{{1}},
  1981  	},
  1982  	{
  1983  		Query:    `SELECT REGEXP_LIKE("-", "[\\d-x]");`,
  1984  		Expected: []sql.Row{{1}},
  1985  	},
  1986  	{
  1987  		Query:    `SELECT REGEXP_LIKE(" testing!1972", "([\s]*)([\S]*)([\s]*)");`,
  1988  		Expected: []sql.Row{{1}},
  1989  	},
  1990  	{
  1991  		Query:    `SELECT REGEXP_LIKE(" testing!1972", "(\s*)(\S*)(\s*)");`,
  1992  		Expected: []sql.Row{{1}},
  1993  	},
  1994  	{
  1995  		Query:    `SELECT REGEXP_LIKE("\377", "\xff");`,
  1996  		Expected: []sql.Row{{0}},
  1997  	},
  1998  	{
  1999  		Query:    `SELECT REGEXP_LIKE("\377", "\x00ff");`,
  2000  		Expected: []sql.Row{{0}},
  2001  	},
  2002  	{
  2003  		Query:    `SELECT REGEXP_LIKE("\t\n\v\r\f\a", "\t\n\v\r\f\a");`,
  2004  		Expected: []sql.Row{{1}},
  2005  	},
  2006  	{
  2007  		Query:    `SELECT REGEXP_LIKE("\t\n\v\r\f\b", "[\t][\n][\v][\r][\f][\b]");`,
  2008  		Expected: []sql.Row{{1}},
  2009  	},
  2010  	{
  2011  		Query:    `SELECT REGEXP_LIKE("smil", "(([a-z]+):)?([a-z]+)$");`,
  2012  		Expected: []sql.Row{{1}},
  2013  	},
  2014  	{
  2015  		Query:    `SELECT REGEXP_LIKE("", "((.)\1+)");`,
  2016  		Expected: []sql.Row{{0}},
  2017  	},
  2018  	{
  2019  		Query:    `SELECT REGEXP_LIKE("abc\nabd", ".*d");`,
  2020  		Expected: []sql.Row{{1}},
  2021  	},
  2022  	{
  2023  		Query:       `SELECT REGEXP_LIKE("", "(");`,
  2024  		ExpectedErr: regex.ErrInvalidRegex,
  2025  	},
  2026  	{
  2027  		Query:    `SELECT REGEXP_LIKE("!", "[\41]");`,
  2028  		Expected: []sql.Row{{0}},
  2029  	},
  2030  	{
  2031  		Query:    `SELECT REGEXP_LIKE("x", "(x?)?");`,
  2032  		Expected: []sql.Row{{1}},
  2033  	},
  2034  	{
  2035  		Query:    `SELECT REGEXP_LIKE("foo", "(?x) foo ");`,
  2036  		Expected: []sql.Row{{1}},
  2037  	},
  2038  	{
  2039  		Query:    `SELECT REGEXP_LIKE("abcdefdof", "(?<!abc)(d.f)");`,
  2040  		Expected: []sql.Row{{1}},
  2041  	},
  2042  	{
  2043  		Query:    `SELECT REGEXP_LIKE("laser_beam", "[\w-]+");`,
  2044  		Expected: []sql.Row{{0}},
  2045  	},
  2046  	{
  2047  		Query:    `SELECT REGEXP_LIKE("xx:", ".*?\S *:");`,
  2048  		Expected: []sql.Row{{0}},
  2049  	},
  2050  	{
  2051  		Query:    `SELECT REGEXP_LIKE("a   10", "a[ ]*?\ (\d+).*");`,
  2052  		Expected: []sql.Row{{0}},
  2053  	},
  2054  	{
  2055  		Query:    `SELECT REGEXP_LIKE("a    10", "a[ ]*?\ (\d+).*");`,
  2056  		Expected: []sql.Row{{0}},
  2057  	},
  2058  	{
  2059  		Query:    `SELECT REGEXP_LIKE("xx\nx\n", "(?ms).*?x\s*\Z(.*)");`,
  2060  		Expected: []sql.Row{{0}},
  2061  	},
  2062  	{
  2063  		Query:    `SELECT REGEXP_LIKE("MMM", "(?i)M+");`,
  2064  		Expected: []sql.Row{{1}},
  2065  	},
  2066  	{
  2067  		Query:    `SELECT REGEXP_LIKE("MMM", "(?i)m+");`,
  2068  		Expected: []sql.Row{{1}},
  2069  	},
  2070  	{
  2071  		Query:    `SELECT REGEXP_LIKE("MMM", "(?i)[M]+");`,
  2072  		Expected: []sql.Row{{1}},
  2073  	},
  2074  	{
  2075  		Query:    `SELECT REGEXP_LIKE("MMM", "(?i)[m]+");`,
  2076  		Expected: []sql.Row{{1}},
  2077  	},
  2078  	{
  2079  		Query:    `SELECT REGEXP_LIKE("", "^*");`,
  2080  		Expected: []sql.Row{{1}},
  2081  	},
  2082  	{
  2083  		Query:    `SELECT REGEXP_LIKE("one\ntwo\nthree\n", "^.*?$");`,
  2084  		Expected: []sql.Row{{0}},
  2085  	},
  2086  	{
  2087  		Query:    `SELECT REGEXP_LIKE("a>b", "a[^>]*?b");`,
  2088  		Expected: []sql.Row{{0}},
  2089  	},
  2090  	{
  2091  		Query:    `SELECT REGEXP_LIKE("foo", "^a*?$");`,
  2092  		Expected: []sql.Row{{0}},
  2093  	},
  2094  	{
  2095  		Query:    `SELECT REGEXP_LIKE("ab", "^((a)c)?(ab)$");`,
  2096  		Expected: []sql.Row{{1}},
  2097  	},
  2098  	{
  2099  		Query:    `SELECT REGEXP_LIKE("abc", "^([ab]*?)(?=(b)?)c");`,
  2100  		Expected: []sql.Row{{1}},
  2101  	},
  2102  	{
  2103  		Query:    `SELECT REGEXP_LIKE("abc", "^([ab]*?)(?!(b))c");`,
  2104  		Expected: []sql.Row{{1}},
  2105  	},
  2106  	{
  2107  		Query:    `SELECT REGEXP_LIKE("abc", "^([ab]*?)(?<!(a))c");`,
  2108  		Expected: []sql.Row{{1}},
  2109  	},
  2110  }