docs:ax25:parsing_tnc2
Table of Contents
Parsing TNC2 monitor frames
The following regexes enable you to parse AX.25 UI frames formatted according to the TNC2 Monitor format.
PCRE Regex
/^([0-9A-Za-z]+(?:-[A-Za-z0-9]+)?)>((?1))((?:,(?1)\*?)*),(qA[A-Z]),((?1)):(.+)$/gmu
Matches are sorted as following:
| group | type |
|---|---|
| 1 | Sender |
| 2 | Destination |
| 3 | AX.25 path |
| 4 | Q construct |
| 5 | Source server |
| 6 | Payload |
Javascript
/^(?<sender>[0-9A-Za-z]+(?:-[A-Za-z0-9]+)?)>(?<dest>[0-9A-Za-z]+(?:-[A-Za-z0-9]+)?)(?<path>(?:,[0-9A-Za-z]+(?:-[0-9]+)?\*?)*),(?<qcons>qA[A-Z]),(?<srvsrc>[0-9A-Za-z]+(?:-[A-Za-z0-9]+)?):(?<payload>.+)$/gmu
This regex features named groups:
| group | type |
|---|---|
| sender | Sender |
| dest | Destination |
| path | AX.25 path |
| qcons | Q construct |
| srvsrc | Source server |
| payload | Payload |
docs/ax25/parsing_tnc2.txt · Last modified: 2020/11/13 19:48 by root