On 25 Apr, 17:49, "Christof Nordiek" <c...@nospam.dewrote:
Hi Barry,
in regular expressions '\t' is the escapesequence for a tab character. If
you want to find '\t' you've got to escape the '\' itself by '\\'.
try
oldString = @"C:\\ta";
likewise @"\\" in your code gives the regex-representation for a single '\'.
First you have to think, wich charactersequence your regex must have, what
may need escapesesequences. Then you've got to think, how this character
sequences is to be represented as literal in C# (or wich ever language you
use).
hth
Christof
Ah, I see, thanks for your help. This works -
string oldString = @"C:\\ta";
Regex regexEndsInBackslash = new Regex(oldString ,
RegexOptions.Singleline | RegexOptions.IgnoreCase);
if (regexEndsInBackslash.Match(@"C:\ta").Success == true)
...
But I use oldString = @"C:\ta"; throughout my program. How can I
escape the backslashes in oldString when using it in my
regexEndsInBackslash definition? Use another Regex?
Thanks again,
Barry.