I'm not that adept at regex and really need some guidance here. Below are my expressions
First I am looking for all instances of Comstock that are not Comstock (exact case match)
(?!comstock)(?i)\Comstock\b
Second I'm looking only for fully lower case comstock.
?!comstock)(?i)\Comstock\b
Both of these expressions work just fine in an online tester however .NET complains about the \C as an unrecognized escape sequence. I've tried using Regex.Escape("\C") in the string as well as manually making it "\\C" however while passing the parser without error, it now fails to match any data.
So.. is there anyway to create that expression such that it finds instances of comstock that do not match a case sensitive comparison?
Question
+Biscuits Brown MVC
I'm not that adept at regex and really need some guidance here. Below are my expressions
First I am looking for all instances of Comstock that are not Comstock (exact case match)
(?!comstock)(?i)\Comstock\b
Second I'm looking only for fully lower case comstock.
?!comstock)(?i)\Comstock\b
Both of these expressions work just fine in an online tester however .NET complains about the \C as an unrecognized escape sequence. I've tried using Regex.Escape("\C") in the string as well as manually making it "\\C" however while passing the parser without error, it now fails to match any data.
So.. is there anyway to create that expression such that it finds instances of comstock that do not match a case sensitive comparison?
Link to comment
https://www.neowin.net/forum/topic/1377611-need-some-net-based-regex-help/Share on other sites
4 answers to this question
Recommended Posts