[英]Regex to check if text contains one of two words and preceding number
Now i need help of some regex pros since i'm normally trying to avoid them if possible. 现在,我需要一些正则表达式专业人士的帮助,因为如果可能的话,我通常会尽量避免使用它们。 I need it in a sql-server query where i don't see any other option than using regex.
我在sql服务器查询中需要它,除了使用正则表达式外,我看不到任何其他选项。
This text must be a match: 此文本必须是匹配项:
####:;Approval:;EC 33/37:1- goodwill validation
because it contains one of those sub-strings 因为它包含那些子字符串之一
and before it there must be 1-
. 并且在它之前必须有
1-
。 I could use this sql query: 我可以使用此sql查询:
WHERE d.REMARKS LIKE '%1-%CASEID%' OR d.REMARKS LIKE '%1-%Goodwill%'
but the problem is that it also matches if there is another digit before the 1 which makes it a different number. 但是问题在于,如果在1之前还有另一个数字,则它也将匹配,从而使它成为另一个数字。 So before the 1 there can be any letter but no digit.
因此,在1之前可以有任何字母,但没有数字。
This is what i've t ried without success : 这是我尝试没有成功的事情:
.*[^0-9]1-.*(CASEID|Goodwill).*
The C# tag because i'm using C# SqlFunction for the regex. C#标记,因为我将C# SqlFunction用于正则表达式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.