正規表現で部分文字列の抜き出し
<life rfid="0107c3c495" contentsid="15" value="onTag"/>
public static string extractRfid(string messageFromAir) { string rfid = ""; if (Regex.Match(messageFromAir, "<life.* rfid=\"([a-zA-Z0-9]+)\".*/>", RegexOptions.IgnoreCase).Success) { rfid = Regex.Matches(messageFromAir, "<life.* rfid=\"([a-zA-Z0-9]+)\".*/>", RegexOptions.IgnoreCase)[0].Groups[1].Value; } return rfid; }
0107c3c495
めんどい