第一个
string s = "123and><>ora";
string ex = @"\d*\w*[><]*(\w*)";
MessageBox.Show( Regex.Replace( s,ex,"$1" ) );第二个
string s = "123<>>and--ora";
string ex = @"[\d><\w]*[-]?(\w*)";
MessageBox.Show( Regex.Replace( s,ex,"$1" ) );
string s = "123and><>ora";
string ex = @"\d*\w*[><]*(\w*)";
MessageBox.Show( Regex.Replace( s,ex,"$1" ) );第二个
string s = "123<>>and--ora";
string ex = @"[\d><\w]*[-]?(\w*)";
MessageBox.Show( Regex.Replace( s,ex,"$1" ) );
using System.Text.RegularExpressions; string s = "123and><>ora";
s = Regex.Replace(s,@"\d+\w+","");
Regex re = new Regex(@"\w+");
MatchCollection mc = re.Matches(s);
foreach (Match m in mc)
Console.WriteLine(m.Value); s = "123<>>and--ora";
s = Regex.Replace(s,@"(\d+|[<>]+)\w+","");
re = new Regex(@"\w+");
mc = re.Matches(s);
foreach (Match m in mc)
Console.WriteLine(m.Value);
1,提取前面没有数字的字母
"(?<!\d)\w*"2,提取前面没有数字,逻辑符号的字母
"(?<![\d<>])\w*"