我需要对这个字符串使用正则表达式:
"\r\n+CMGL: 0,\"REC READ\",\"+79119968091\",,\"13/10/28,15:22:36+16\"\r\n10160008\r\n $GPMC,081915,A,5614.6801,N,04359.0266,E,0.0,190.2,121109,,*19\r\n+CMGL: 1,\"REC READ\",\"+79119968091\",,\" 13/10/28,15:34:26+16\"\r\n#ALARM! \r\n10160008\r\n$GPMC,081915,A,5614.6801,N,04359.0266,E,0.0,190.2,121109 ,,*19\r\n\r\n好的\r\n"
我需要从上面的字符串中获取 2 个子字符串(每个子字符串都以\r\n+CMGL:开头并以\r\n结尾):
- \r\n+CMGL: 0,\"REC READ\",\"+79119968091\",,\"13/10/28,15:22:36+16\"\r\n10160008\r\n$ GPMC,081915,A,5614.6801,N,04359.0266,E,0.0,190.2,121109,,*19\r\n
- \r\n+CMGL: 1,\"REC READ\",\"+79119968091\",,\"13/10/28,15:34:26+16\"\r\n#ALARM! \r\n10160008\r\n$GPMC,081915,A,5614.6801,N,04359.0266,E,0.0,190.2,121109,,*19\r\n
我有这个正则表达式
Regex r = new Regex(@"\+CMGL: (\d+),""(.+)"",""(.+)"",(.*),""(.+)""(\r\n((.|\n)*)\r\n\b)");
此正则表达式效果很好,但不适用于最后一组 (\r\n((.|\n)*)\r\n\b)。问题是我不知道\r\n符号字符串会有多少,直到我看到新子字符串的开始(\r\n+CMGL:)。预先感谢