Assuming I have a text file with the following content:
longtextwith some space and unicode escape like this \u003ca
I want to replace all instances / occurences / sequences of \u003c
ignoring the fact that an a
is trailing. Something like "look for all instances of a sequence of characters, ignore cases and replace it".
I tried this already but nothing happens:
using (var sr = new StreamReader("1.txt"))
{
string result = sr.ReadToEnd();
result = Regex.Replace(result, @"\b\\u003c\b", "<", RegexOptions.IgnoreCase);
}
This variants also yielded not my intended result:
result = Regex.Replace(result, @"\\u003c", "<", RegexOptions.IgnoreCase);
result = Regex.Replace(result, "\u003c", "<", RegexOptions.IgnoreCase);
result = Regex.Replace(result, "\b\\u003c\b", "<", RegexOptions.IgnoreCase);
In Lua this works: str = string.gsub(str, '\\u003e', '>')
In this case I am not interested in the options provided by .NET framework for encoding and decoding of unicode, ascii etc.