An alternative to the suggestion to use a regex C library is to embed Lua code into your C code. Lua+C is great for resource constrained embedded systems and can make text parsing a lot less painful than using pure C.
The Lua docs provide some examples of integrating Lua into C here - https://www.lua.org/pil/24.1.html.