I'm trying to use regex to parse the elements in the result of AT commands.
The structure of this is as follows:
OK
AT!GSTATUS?
!GSTATUS:
Current Time: 2420 Temperature: 30
Reset Counter: 1 Mode: ONLINE
System mode: LTE PS state: Attached
LTE band: B30 LTE bw: 10 MHz
LTE Rx chan: 1234 LTE Tx chan: 12345
LTE CA state: NOT ASSIGNED
EMM state: Registered Normal Service
RRC state: RRC Idle
IMS reg state: No Srv
PCC RxM RSSI: -74 RSRP (dBm): -103
PCC RxD RSSI: -74 RSRP (dBm): -104
Tx Power: 0 TAC: 123A (1234)
RSRQ (dB): -12.4 Cell ID: 1234AB56 (12345678)
SINR (dB): 9.4
I wish to capture every attribute behind the colon in one group and the result in another group in the match.
| Match |
| Group 1 | Group 2 |
- Cell ID | 1232AA96 (12345678) |
- TAC | 123A (1234) |
Currently, I have come up with:
r" ([0-9A-Za-z()]+):\s*([0-9A-Za-z()]+\s?[0-9A-Za-z()]+[\n])" gm
https://regex101.com/r/DS6IIk/1
What would be the best way of approaching this?