Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Search for first substring in string with condition - response (4) by PeterSchwennesen

$
0
0

Hi, thanks for the answers. I look at it.
Yes everything is possible.
Problem is: find first "b" not between two "a". There therefore (“-“ just represent random number of char)
ababbb should return me 4
a-b-a-bbb should return 7
baba should return 1
The original problem is that I am trying to clean out comments from my code. So in real life I am not looking for A’s and B’s, but “/*”, and “*/” and “—“.
But I ran into the problem that in some places the /* do not represent a comment, but is part of a text string. Therefore:
SELECT ‘SOME TEXT’, /* this is …. Here I want to find the position of “/*”.
But:
SELECT ‘SOME /* OTHER TEXT’, /*
Here I should not consider the first /* as a comment but only the second one.


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>