Sujet : Static regex for embedded systems
De : pozzugno (at) *nospam* gmail.com (pozz)
Groupes : comp.arch.embeddedDate : 21. Jan 2025, 15:31:52
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vmob4o$3ssqn$2@dont-email.me>
User-Agent : Mozilla Thunderbird
Many times I need to parse/decode a text string that comes from an external system, over a serial bus, MQTT, and so on.
Many times this string has a fixed syntax/layout. In order to parse this string, I everytime create a custom parser that can be tedious, cumbersom and error prone.
For example, suppose you have to decode a string from a modem that uses AT commands. Many answers from the modem has the following schema:
\r\n+<prefix>: <field1>,<field2>\r\n
\r\nOK\r\n
The prefix is known, the number and type of fileds are known too. With regex, the parser would be simple.