Page MenuHomePhabricator

RegExp search and replace doesn't work with MS Sql SERVER
Open, LowPublic


Author: emadelwany

MS SQL Server doesn't support the REGEXP operator which causes queries to fail with the following error:

SQL ERROR: [SQLSTATE 42000][Error Code 102][Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near 'REGEXP'.
[SQLSTATE 42000][Error Code 8180][Microsoft][SQL Server Native Client 11.0][SQL Server]Statement(s) could not be prepared.
[SQLSTATE 01000][Error Code 16954][Microsoft][SQL Server Native Client 11.0][SQL Server]Executing SQL directly; no cursor.

Version: REL1_23-branch
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:55 AM
bzimport set Reference to bz71027.
bzimport added a subscriber: Unknown Object (MLST).
Aklapper triaged this task as Low priority.Apr 2 2015, 2:48 PM
Aklapper added a subscriber: Aklapper.
labster added a subscriber: labster.Aug 7 2016, 1:59 AM

As far as I can tell, SQL Server does not support regular expressions -- or at least not without using a CLR function.

In theory, we could just add LIKE '%$target%' as the operation for this, and it would work on some simple searches (including basic character classes), but that would be pretty non-optimal.