asp.net c#で部分文字列の数字が見つかるまで文字を抽出する方法
私の文字列は
NR21380 SR9956 NER6754 WR98765 SR98700
正規表現を使用して、文字以外をすべて置き換えることができます。
string s=NR21380 SR9956 NER6754 WR98765 SR98700
string s2 = Regex.Replace(s, @"[^A-Z]+", String.Empty);
これを試して
String aa = "NR21380 SR9956 NER6754 WR98765 SR98700";
//getting the first chars from the dummy string.
var firstChars= Regex.Match(aa, @"[A-Z]+");