Perl influenced in Oracle regexp
mathguy, January 16, 2025 - 5:34 pm UTC
The big point here is that in a matching character class, most of the meta characters lose their special meaning - not just the escape operator. Chris already showed the right way to do what you attempted - use alternation (in parentheses), not matching character classes.
Aside from that, please note that Oracle doesn't support \n. This applies to Chris's solution too, his expression will also match a literal n (the backslash will just be ignored). Also, \s which is the same as [:space:] does NOT mean "space", but "any whitespace character" ( including both "space" and "newline" but also tab, formfeed, carriage return). If that is what you actually need, just use \s, no need to figure out how to deal specifically with \n.
January 20, 2025 - 8:36 am UTC
Good point mathguy, thanks for the correction