Hello, can you share my the code on how to get only the certain string?
this is the whole string.
AT+CMGL=4\r\r\n+CMGL: 1,2,,48\r\n079136190800101011000BA19084537777F70008AA2200540065007300740020004D0065007300730061006700650020005000440055002E\r\n+CMGL: 2,1,,34\r\n0791361908005043040C9136493875777700005101519103652311D4F29C0E6A96E7F3F0B90C8212AB2E\r\n\r\nOK\r\n
now I wan to parse and get only this.
079136190800101011000BA19084537777F70008AA2200540065007300740020004D0065007300730061006700650020005000440055002E
or
0791361908005043040C9136493875777700005101519103652311D4F29C0E6A96E7F3F0B90C8212AB2E
this is the code that I've used but not working.
public ShortMessageCollection ParseMessagesPDU(string input)
{
ShortMessageCollection messages = new ShortMessageCollection();
try
{
Regex r = new Regex(@"\+CMGL: (\d+),(\d+),,(\d+)\\r\\n(.*?)\\r\\n", RegexOptions.IgnoreCase | RegexOptions.Singleline);
Match m = r.Match(input);
while (m.Success)
{
ShortMessage msg = new ShortMessage();
msg.Index = m.Groups[1].Value;
msg.Status = m.Groups[2].Value;
msg.Sender = m.Groups[3].Value;
msg.Alphabet = m.Groups[4].Value;
msg.Sent = m.Groups[5].Value;
msg.Message = m.Groups[6].Value;
messages.Add(msg);
m = m.NextMatch();
}
}
catch (Exception ex)
{
}
return messages;
}
Hope you can help me with this problem.
Thank you.