2

For example:

where strword match with {%{J{GC * GC}J} or strword={%{J{GC * GC}J}
Serge S.
  • 4,855
  • 3
  • 42
  • 46
mj-gholami
  • 883
  • 1
  • 6
  • 19
  • possible duplicate of http://stackoverflow.com/questions/194652/sql-server-regular-expressions-in-t-sql – Roman Bataev May 08 '12 at 17:04
  • 1
    @Roman - It is a very similar question but other post specifically states they do not want a CLR approach. If this poster is OK with CLR then it might not be a duplicate question. – RThomas May 08 '12 at 17:07
  • 2
    "Native" T-SQL has no regular expression support - you'll need e.g. a SQL-CLR library (.NET library) to add this capability – marc_s May 08 '12 at 17:13

1 Answers1

6

I typically try to avoid posting answers that are simply links to somewhere else. But in this case it's a fairly big answer as you have to involve CLR in your approach.

So - in this case I'm going to make an exception and just give you a link. I feel better about it since it's an official Microsoft doc and they are pretty good about not moving things around.

Here's the walk through from Microsoft on using RegEx with SQLServer.

It has good sample code and is extensive in it's coverage. If your OK with adding CLR to your solution then it should give you exactly what you need.

Update: Turns out Microsoft did in fact change that link. Another walk through by a respected company (Red Gate) can be found here: https://www.red-gate.com/simple-talk/sql/t-sql-programming/clr-assembly-regex-functions-for-sql-server-by-example/

RThomas
  • 10,702
  • 2
  • 48
  • 61