[英]Select string that has at least 2 alphabetic characters
How to make a select that returns only the strings that contain at least 2 alphabetic characters. 如何进行选择,使其仅返回至少包含2个字母字符的字符串。 The string can contain any combination of characters
字符串可以包含任何字符组合
ID Name
1 John
2 John2
3 2
4 /
5 12-
6 JW
7 Jw1
8 ,
where regexp_like(str, '[a-z].*[a-z]', 'i');
should do it. 应该这样做。
The 'i'
parameter (specific to Oracle SQL regex functions) makes it case-insensitive. 'i'
参数(特定于Oracle SQL regex函数)使其不区分大小写。
Explanation: https://regex101.com/r/OYec02/1 说明: https : //regex101.com/r/OYec02/1
If you're using 11g or later (and you should be) you can use regexp_count()
to do this: 如果您使用的是11g或更高版本(应该是),则可以使用
regexp_count()
进行此操作:
where regexp_count(txt, '[a-z]', 1, 'i') >= 2
This is handy where the number of characters you want to match is larger than two. 如果要匹配的字符数大于两个,这很方便。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.