I just used this regex tester: http://www.carljohansen.co.uk/utils/regexpdotnet.aspx
Using this regex: [^\\]typeA
Against your original post it found 4 instances, not 7 It should do about what you want.
The ^ means not and the double backslash is escaping the backslash you do not want.
In essence it is saying look for something that is not an backslash followed by typeA and that is a match.
I hope this helps.
Don
Match #1 (char 213): typeA
Match #2 (char 277): typeA
Match #3 (char 385): typeA
Match #4 (char 482): typeA
-------------------
You can try the complete solution here: http://www.compileonline.com/compile_csharp_online.php
string source = @"Hello I am trying to replace text in files - I know I can search with in files of a given directory and read all text - then use replace functions but how do I get the regular expression tester to replace text of typeA but not text of \typeA , please note the backslash before typeA . Is there a simple method to do this ? I know I can check for \typeA and I know I can check for this typeA and getmatches but the spin here for me is how to unmatch the ones with the \ the thing is typeA could be prefixed by "",{ or nothing at all but in all cases I would like to exclude \typeA from the change. Just an FYI the \ is not an escape character in these files. ";
string match = @"([^\\])typeA";
string replace = @"$1typeB";
string target = Regex.Replace(source, match, replace);
Console.WriteLine(target);
Just paste it in over what they have in main, and press "Compile & Execute"
Make sure you add:
using System.Text.RegularExpressions;
at the top
Don