A set of technologies in the .NET Framework for building web applications and XML web services.
To consider letters only, try this: @"\b(\p{L}{2}|[^MF\s])\b\s*".
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi there,
I have the following string to be cleaned of 1 and 2 character words unless it's the letter M or F.
EL EL EL EL M EL EL FU S FF EL EL EL E EL
I tried with the following expression but it didn't work quite well.
var output = Regex.Replace(input, @"\b\w{2}\s", "").Trim();
I ended up with "M S E EL"
Could you help me so I can end up with only M?
Would be greatly appreciated. Thanks
A set of technologies in the .NET Framework for building web applications and XML web services.
An object-oriented programming language developed by Microsoft that can be used in .NET.
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
Answer accepted by question author
To consider letters only, try this: @"\b(\p{L}{2}|[^MF\s])\b\s*".
var output = Regex.Replace(input, @"\b\w{2}\s", "").Trim();csv1_csv_log (2).txt