7

I'm trying to build a search query to match whole words in SQLite and C# on Windows. When I run a query like this:

SELECT a, b FROM Events WHERE c REGEXP @SearchString;

Then:

cmd.Parameters.Add(new SQLiteParameter("@SearchString", 
"%[^a-zA-Z0-9]" + searchdata.SearchText + "[^a-zA-Z0-9]%"));

And when I call:

var r = cmd.ExecuteReader();

I get REGEXP no such function. I wonder how to activate REGEXP support and CASE SENSITIVE search.

Pablo Yabo
  • 2,460
  • 2
  • 24
  • 32

2 Answers2

5

I've got it! The problem was that I didn't define the REGEXP function. I've got from here: here a definition for C#.

Community
  • 1
  • 1
Pablo Yabo
  • 2,460
  • 2
  • 24
  • 32
0

You shouldn't need the %. That is only for LIKE.

Daniel A. White
  • 181,601
  • 45
  • 354
  • 430