I have a column criteria which contains below similar text in each of its row:-
inclusion : ajjsdijd
sdsjdjs
ieroeito trorg inclusion
sdkjwedk
exclusion :
sdkjwdowek
ksdldk exclusion
skdkefk
kfkwkfwe
I want to extract the text between first inclusion and exclusion occurance. So, here i want result as
ajjsdijd
sdsjdjs
ieroeito trorg inclusion
sdkjwedk
Also, I want to extract the text after first exclusion keyword:
sdkjwdowek
ksdldk exclusion
skdkefk
kfkwkfwe
I am currently using below PostgreSQL but this creates issue and picks text between first inclusion and last exclusion..
substring(lower(criteria) from 'inclusion(.+)exclusion')
substring(lower(criteria) from 'exclusion(.+)')