From 8e8628ae33736a6c61a7786e80c1b20a9b17846a Mon Sep 17 00:00:00 2001 From: Brendan McMullen Date: Wed, 10 Jun 2026 14:35:09 -0700 Subject: [PATCH] like matches strings containing newlines --- src/expression/binary.js | 2 +- test/execute/execute.where.test.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/expression/binary.js b/src/expression/binary.js index bdb6522..20408a0 100644 --- a/src/expression/binary.js +++ b/src/expression/binary.js @@ -55,7 +55,7 @@ export function applyBinaryOp(op, a, b) { .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') .replace(/%/g, '.*') .replace(/_/g, '.') - const regex = new RegExp(`^${regexPattern}$`, 'i') + const regex = new RegExp(`^${regexPattern}$`, 'is') return regex.test(str) } diff --git a/test/execute/execute.where.test.js b/test/execute/execute.where.test.js index b4442a1..ce8c4a4 100644 --- a/test/execute/execute.where.test.js +++ b/test/execute/execute.where.test.js @@ -195,6 +195,16 @@ describe('WHERE clause', () => { expect(result.map(r => r.email).sort()).toEqual(['alice@example.com', 'diana@example.com']) }) + it('should filter with LIKE across newlines', async () => { + const data = [ + { id: 1, s: 'line one\nFind me\nline three' }, + { id: 2, s: 'nothing here' }, + ] + const result = await collect(executeSql({ tables: { data }, query: 'SELECT * FROM data WHERE s LIKE \'%Find me%\'' })) + expect(result).toHaveLength(1) + expect(result.map(r => r.id)).toEqual([1]) + }) + it('should filter with NOT LIKE', async () => { const result = await collect(executeSql({ tables: { users }, query: 'SELECT * FROM users WHERE name NOT LIKE \'%li%\'' })) expect(result).toHaveLength(3)