Find '[' and get sub-string before it by using regexp_substr()
843098Feb 26 2011 — edited Mar 1 2011Hi,
select regexp_substr('What a good day for (YOU [ME] and HIM','[:ALNUM:]*[^\(]*') from dual;
result is:
SQL> What a good day for
but why this pattern does not work for ']' when I replace '(' with ']'?
select regexp_substr('What a good day for (YOU [ME] and HIM','[:ALNUM:]*[^\]]*') from dual;
result is:
SQL> W
I need to get a sub-string before either '(', '[', '{' , ')', ']', or '}' in a give string, this pattern works for '(', ')', '{', '}' but not '[' or ']'
what should the pattern be? If '[:ALNUM:]*[^\(]*' is not correct?
Can anyone help?
thanks
Fiona