Search code examples
sqlregexoracle11gregexp-like

Is 'a^b' a valid Regular Expression in oracle sql?


Is 'a^b' a valid Regular Expression in oracle sql? If yes what are the strings(give some examples) that could qualify.

select name from employees where regexp_like(name,'a^b'); 

Solution

  • It's valid, but it will never match anything. ^ is a zero-width assertion that matches the beginning of the string or right after a newline. But it can't match a\nb ( a-newline-b) because there's nothing in the regex to match the newline itself. So a^b is syntactically valid, but it's nonsense.