I've tried to invent an exercise to take practice with lex.
Here is the result.
We can say that is more a micro-parser than a lexer.
It use a grammar to parse a simple tag language that describes a telephone memo and generate an html page to format it better.
It's just an exercise and you can download it at
Obviously GPLv3 licensed :)