i have this kind of string File type: Wireshark - pcapng
so what i want is if my string start with File type: take and parse only Wireshark - pcapng
this is what i have try:
var myString = @":\s*(.*?)\s* ";
Instead of REGEX, use string.StartsWith method, something like:
if(str.StartsWith("File type:"))
Console.WriteLine(str.Substring("File type:".Length));
You will get:
Wireshark - pcapng
If you want to get rid of leading/trailing spaces from the resultant string then use string.Trim like:
Console.WriteLine(str.Substring("File type:".Length).Trim());
Or if you just want to get rid of leading spaces then use string.TrimStart like:
Console.WriteLine(str.Substring("File type:".Length).TrimStart(' '));
:.string.Trim, check the latest answer