I have a string in the following format that contains a index number, phone number, group Number and contact Name. Can you create some regex to extract all from follwing string ?
"AT+CPBR=1\r\r\n+CPBR: 1, "0342123456", 129, "simnumber"\r\n\r\nOK\r\n"
Breakdown:
"AT+CPBR=1\r\r\n+CPBR: 1 (Index Number)
, "0342123456" (PhoneNumber)
, 129 (Group Number)
, "simnumber" (contact Name)
Regex escape characters are different depending on the language. Try this assuming that the middle 7 digits is the phone number.
this will return
In the capture group.
Update
In re-reading your question I’m guessing that the escape sequences are escaped in your input string so that your real input is (\r & \n left in place for simplicity).
With C# you can use the following
This will result in
Remember that Groups[0] contains the entire match including the quotes.