简体   繁体   English

Oracle:点的正则表达式

[英]Oracle: Regular expression for dot

For example, I have a table "example" which has a column "col1" with string like below 例如,我有一个表“ example”,其中有一个列“ col1”,其字符串如下所示

some example text here x2.0.3-a abc
some other example text 1.5 abc
another example text 0.1.4 mnp
some other example text  abc
another example text mnp

I want to select those rows that matches a regular expression. 我想选择与正则表达式匹配的那些行。 I want the regular expression something like this 我想要这样的正则表达式

any string.any string.any string space abc/mnp or any string.any string space abc/mnp that is the regular expression should match two or three dots, before and after of each dot there should be at least one string(char/number/special chars) and then a single space and then at the end either abc/mnp . 正则表达式的any string.any string space abc/mnp any string.any string.any string space abc/mnpany string.any string space abc/mnp应该匹配两个或三个点,每个点的前后至少应有一个字符串(char /数字/特殊字符),然后是单个空格,最后是abc/mnp What will be the regular expression and sql query for this? 正则表达式和sql查询是什么?

Check on the next regex ^[^.]+?(\\.[^.]+?){1,2} (abc|mnp)$ . 检查下一个正则表达式^[^.]+?(\\.[^.]+?){1,2} (abc|mnp)$

To try the regular expression online, click here . 要在线尝试正则表达式,请单击此处

To get an explanation go to here . 要获得解释,请转到此处

I am not sure if i got your question right , but in case if you are looking to select columns which has any.any or any.any.any in your column then the below regex can help 我不确定我的问题是否正确,但是如果您要选择的列中包含any.any或any.any.any的列,则下面的正则表达式可以为您提供帮助

^.*?(\S+\.\S+).*[ ](?:abc|mnp)$

Demo here 在这里演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM