An object-oriented programming language developed by Microsoft that can be used in .NET.
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
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.
A set of technologies in .NET for building web applications and web services. Miscellaneous topics that do not fit into specific categories.
To consider letters only, try this: @"\b(\p{L}{2}|[^MF\s])\b\s*".
Check this pattern: @"\b(\w{2,}|[^MF\s])\b\s*".