[thelist] regexp in MSSQL?

Ashok Hariharan listman at hazard0us.org
Wed Dec 4 01:04:12 CST 2002


Unfortunately the regexps you can apply with a SQL statement are
limited to a few expressions like ?, %, [] and you cannot do things
like back-referencing.

While it is possible to do what you are saying through TSQL using
a combination of charindex(), patindex() etc., it would be much easier
to write a vbscript/javascript program to connect to the db, do a
getchunk() of the text field into a string.  Then, use the regular
object provided by vbscript or javascript to do the search and replace on
that string .
Finally update the data back to the SQL Server....


>All my articles are text fields in an MSSQL 2000 table. Can I do a search
>and replace to look for '<a [anything] CDNow.com [anything] >' and replace
>with a dead link? (I realize there'll be some issues with figuring out how
>to prevent greedy regexps from sucking every link in an article into just
>one; just getting the procedure figured out first.)

Ashok Hariharan

More information about the thelist mailing list