c# - The case of the sneaky backslash - Regex -


I have some very clear, but I can not see it.

I found:

  string input = "" 999 \ abc.txt "; string pattern = @" \\ (. *) "; String output = reges. Match (input, pattern). Ostring (); Console.WriteLine (output);  

My result is:

  \ abc.txt  

I do not want slash and it does not understand why it enters the output. I tried to flip the pattern and wind up the slash output again:

  string pattern = @ "^ (. *) \\";  

and get:

  999 \  

The result of a strange Oshrehv regulator is OK. Any thoughts?

< P> Thank you.

mail full match

  string output = regescus match (input, pattern) group [1]. Value;  

(memory Can be slightly different)


Comments