具有特定字符的正则表达式字符串
Regexp strings with specific characters
我想创建一个查询,其中我 select 所有可能包含来自 3 个特殊字符组的字母、数字和特殊字符的记录:/
"
,
我试过 '[0-9a-zA-Z(\-\/\")]'
但 'a+'
之类的方法有效
试试这个正则表达式:
[0-9a-zA-Z/",]+
是这样的吗?
SQL> with test (col) as
2 (-- valid values
3 select 'Little12' from dual union all
4 select 'Foot/15' from dual union all
5 select '"London",UK' from dual union all
6 -- invalid values
7 select '25+ miles' from dual union all
8 select 'me@gmail.com' from dual
9 )
10 select col
11 from test
12 where regexp_like(col, '^[a-zA-Z0-9/",]*$');
COL
------------
Little12
Foot/15
"London",UK
SQL>
我想创建一个查询,其中我 select 所有可能包含来自 3 个特殊字符组的字母、数字和特殊字符的记录:/
"
,
我试过 '[0-9a-zA-Z(\-\/\")]'
但 'a+'
之类的方法有效
试试这个正则表达式:
[0-9a-zA-Z/",]+
是这样的吗?
SQL> with test (col) as
2 (-- valid values
3 select 'Little12' from dual union all
4 select 'Foot/15' from dual union all
5 select '"London",UK' from dual union all
6 -- invalid values
7 select '25+ miles' from dual union all
8 select 'me@gmail.com' from dual
9 )
10 select col
11 from test
12 where regexp_like(col, '^[a-zA-Z0-9/",]*$');
COL
------------
Little12
Foot/15
"London",UK
SQL>