asp.net - Is it possible to turn off case insensitivity using pattern only? -
regex has set option ignorecase. possible turn off case insensitivity using pattern (like negation of (?i))?
in example below, find pattern result "abaaabbaab".
string pattern = "???"; string input = "aaaaaaaaaa"; var regex = new regex(pattern, regexoptions.ignorecase); var result = regex.replace(input, "b");
you can turn off options inline using -
before option. e.g. negation of (?i)
(?-i)
:
a minus sign (-) before option or set of options turns options off. example, (?i-mn) turns case-insensitive matching (i) on, turns multiline mode (m) off, , turns unnamed group captures (n) off.
Comments
Post a Comment