Regular expressions Ignore case in search, but do not replace
In C #, I want to be able to replace text altogether, ignoring case in search, but not in replacement (kind?). Here's an example:
I have a list that looks like this:
Site → Location
Item → Items
etc...
Then I want to call ConvertMyString ("Site") and return "Location" to it.
While it works for me, BUT ...
If I call ConvertMyString ("site"), I would like it to return "place" (lowercase).
Is there an easy way to do this with RegEx or something without having to list all uppercase and lowercase versions?
+1
source to share
2 answers
Can you use MatchEvaluator to control string replacement? It gets a consistent string so you can look at this and put together a replacement. It looks like he's overkill though
+3
source to share