I need to get text between repeating asterisks in postgresql. String can be either like
"120 B-4, Gl-12 ***Test data****" Some other text" (with text between the asterisks)
or
*****(withoout text)
There can be two or more asterisks When there is text between asterisks result should be the text between the strings but when there is no text it should return empty string. There can be two or more asterisks and there might not be text between asterisks in that case result should be empty string. I was trying to achieve this by using regexp_split_to_array
regexp_split_to_array(o."Posts" , '([\*]{2,})'))[2]).
It works fine when there is text between the strings but when there is no data between the strings it fails.
Edit I think I am doing it the wrong way I need an expression which can match anything between asterisks other than asterisk