sql server - TSQL - Grab valid URLs -


i have table looking this:

url ============== www.google.com http://www.yahoo.com/ www.192.168.1.1.com 192.168.1.5 www.192.168.5.149/service.ir test.sitename.com 

so question seperats 2 sections:

  1. getting urls based on pattern ((http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?).
  2. formatting urls aren't valid (based on pattern)

so came query part one:

select url userwebsites     url '%(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?%' 

but have no idea how format urls.

is there more elegant way this?

t-sql isn't tool doing string parsing--you're far better off writing clr function , doing work there. there tons of things can regex in simple function--and more efficient code (because writing resembling regex functionality t-sql string operators going long , involved).


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -