Text replace with regex in SQL Server

Posted by Thiyaneshwaran S on Stack Overflow See other posts from Stack Overflow or by Thiyaneshwaran S
Published on 2010-06-02T11:12:52Z Indexed on 2010/06/02 11:24 UTC
Read the original article Hit count: 180

Filed under:
|
|
|

Currently I have a SQL server column of type nvarchar(max) which has text that starts with

<span class="escape_<<digits>>"></span>

The only thing that varies in the pattern is the <<digits>> in the class name.

The common part is

<span class="myclass_ 

and the closing

</span>

Some sample values are

<span class="myclass_12"></span>
<span class="myclass_234"></span>
<span class="myclass_4546"></span>

These span text are present only at the beginning of the column. Any such matching span in the middle should not be removed or matched.

Whats the SQL Server query with regex to remove all these occurances of span?

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server