Ignore case with regular expression

I created the CLR in a SQL Server 2005 database. This is a simple user-defined regular expression function that checks if a pattern exists in the string that I pass to the function.

The network point code that I use in the CLR is shown below:

Return System.Text.RegularExpressions.Regex.IsMatch("Input", "pattern")

This returns the bit value 1 if a match is found.

I am using a template

 +(Create|Alter) +(Proc|Procedure) +

I want this to do is to find any cases of "creating or modifying" a procedure or proc, regardless of the case. How can I make an expression ignore case?

I tried

/ +(Create|Alter) +(Proc|Procedure) +/i 

but it does not work.

EDIT: I looked on the internet and used various suggestions. None of them worked, or I did it wrong. If someone can give me a sample that will ignore the case that would be much appreciated!

: , , , . Dot Net , , , CLR, .

, : (? i) + (Create | Alter) + (Proc | Procedure) +

+3
3

" " (?i):

(?i) +(Create|Alter) +(Proc|Procedure) +
+3

.

Return System.Text.RegularExpressions.Regex.IsMatch("input", @".*(Create|Alter).+(Proc|Procedure).+", RegexOptions.IgnoreCase);

Expresso, .Net/# , ..

+3

Try using:

Regex regex = new Regex(
    regexStringHere,
    RegexOptions.IgnoreCase);

return regex.IsMatch(inputStringHere);

Hope this helps.

+2
source

Source: https://habr.com/ru/post/1719718/


All Articles