This question has been answered in the comments by @Marcin Łoś and @Thomas Padron-McCarthy, but remains in the unanswered question queue.
(See Question with no answers, but issue solved in the comments (or extended in chat) )
The Flex lexical analyser can be downloaded (both as source or binary) from https://github.com/westes/flex/releases
There are many good online tutorials you can find by internet search. This one: http://epaperpress.com/lexandyacc/download/LexAndYaccTutorial.pdf was recommended. I also like this one: http://aquamentus.com/flex_bison.html
There are also many helpful demonstrations on YouTube.