在字符串中提取需要的参数
如题,如何在下面的字符串中提取“NAME:”后面的字符串;注意""NAME:出现多次!
TOLERANCE : 0.03
STEPOVER : 1
REST-THICKNESS : 0.35
NUMBER-OF-STATES : 10
STATE-TYPE : BLOCK
NAME : 毛坯
ACTIVE : NO
LOCKED : YES
CALCULATED : YES
VOLUME : 1.74498e+008
STATE-TYPE : TOOLPATH
NAME : 1
ACTIVE : NO
LOCKED : YES
CALCULATED : YES
VOLUME : 1.08081e+008
STATE-TYPE : TOOLPATH
NAME : 3_1
ACTIVE : NO
LOCKED : YES
CALCULATED : YES
VOLUME : 1.07174e+008
STATE-TYPE : TOOLPATH
NAME : 3_2
ACTIVE : NO
LOCKED : YES
CALCULATED : YES
VOLUME : 1.07059e+008
STATE-TYPE : TOOLPATH
NAME : 2
ACTIVE : NO
LOCKED : YES
CALCULATED : YES
VOLUME : 1.07054e+008
STATE-TYPE : TOOLPATH
NAME : 4
ACTIVE : NO
LOCKED : YES
CALCULATED : YES
VOLUME : 1.06947e+008
STATE-TYPE : TOOLPATH
NAME : 3
ACTIVE : YES
LOCKED : YES
CALCULATED : YES
VOLUME : 1.06928e+008
STATE-TYPE : TOOLPATH
NAME : 4_1
ACTIVE : NO
LOCKED : YES
CALCULATED : YES
VOLUME : 1.06896e+008
STATE-TYPE : TOOLPATH
NAME : 4_1_1
ACTIVE : NO
LOCKED : YES
CALCULATED : YES
VOLUME : 1.06879e+008
STATE-TYPE : TOOLPATH
NAME : 4_1_1_1_1
ACTIVE : NO
LOCKED : NO
CALCULATED : YES
VOLUME : 1.06873e+008 字符串?VB .NET 字符串
[解决办法]
string str = "字符串";
var list = Regex.Matches(str, @"(?is)(?<=name\s*[::]\s*)\S+").OfType<Match>().Select(t => t.Value).ToList();