Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
phinix
Starting Member
1 Post |
Posted - 2015-04-28 : 05:26:34
|
Hi guys, I have this function in VB that I used in Access to replace all non-alphanumeric characters, including spaces and anything in brackets.[CODE]Public Function charOnly3(inputString As String) As StringDim RE As ObjectSet RE = CreateObject("vbscript.regexp")RE.Pattern = "\([^)]+\)|[^\w]|_"RE.Global = TruecharOnly3 = RE.Replace(inputString, "")Set RE = NothingEnd Function[/CODE]Now, I moved to SQL server and I'm writing scripts to do same thing.How can I use RegEx in TSQL?Only thing I will do is that function. |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2015-04-28 : 06:59:34
|
A CLR function can perform RegEx operations in SQL 2005 and higher:https://www.simple-talk.com/sql/t-sql-programming/clr-assembly-regex-functions-for-sql-server-by-example/ |
|
|
|
|
|