Oracle regexp_like square brackets inside character set
3
votes
3
answers
10531
views
This questions is in regards to Oracle, pl/sql, and the regexp_like function.
I am trying to build a character set that will match on all typical special characters. My character set currently looks like:
pattern := '[-~`!@#$%^&*\(\)\\{}_+=|''";:,./?]+';
I would like to add the square brackets to this character set, however, whatever I try to add ']' is not working. Here is a simple example that illustrates the problem:
select
case when regexp_like('w]ord', '[\]]+') then 'true'
else 'false' end
from dual;
This returns false, meaning it did not match the ']' character. Curiously, I can get the '[' character to match because this returns true:
select
case when regexp_like('w[ord', '[\[]+') then 'true'
else 'false' end
from dual;
Asked by Elijah W. Gagne
(705 rep)
Aug 6, 2015, 09:13 PM
Last activity: Feb 25, 2025, 05:46 AM
Last activity: Feb 25, 2025, 05:46 AM