Forward slash in c#.net 2.0
can any one help me ....
i use forward slash for regex pattern in c#.net visual studio 2005 but i get double forward slash it appereas like this '\\' but i need to be like this '\'.
EG: string pattern = @"{\*\*\*PART - \d\d\*\*\*}";
I NEED TO GET out put as "{\*\*\*PART - \d\d\*\*\*}" but now its coming as "{\\*\\*\\*PART - \d\d\\*\\*\\*}"
Jan MontanoPosted Jan 2, 2009, 12:24 AM
string pattern = @"{\*\*\*PART - \d\d\*\*\*}" will have an output of "{\*\*\*PART - \d\d\*\*\*}"
it will be read as is because of the @ sign. during debug, you may see the backward slashes prefixed by another backslash but it's alright, in the end it will be interpreted as "{\*\*\*PART - \d\d\*\*\*}" with no additional backslashes.