Since it's not that easy to perform regex in SQL I'll need some advice in how to solve this problem.
I have a column with the following type of data:
Lorem ipsum dolor sit $%foo##amet%$, consectetur adipiscing elit. Nullam odio risus, mollis a interdum vitae, rutrum id leo. Pellentesque dapibus lobortis mattis. Praesent at nisi a orci commodo scelerisque $%bar##%$ eget id dui. Morbi est arcu, ultricies et consequat ac, pretium sed mi. Quisque iaculis pretium congue. Etiam ullamcorper sapien eu mauris tristique at venenatis mauris ultricies. Proin eu vehicula enim. Vestibulum aliquam, mauris ac tempus vulputate, odio mauris rhoncus purus, id suscipit velit erat quis magna.
The bold text I need to match, and it needs to be replaced with the text found in the second part.
Meaning:
$%foo##amet%$becomesamet$%bar##%$becomes an empty string.
The pattern as a regex would be something like \$%[^#]+?##([^%]*?)%\$
I can't really use that though since regex is not really supported in tsql...
Any advice?