Re2c is a free and open-source lexer generator for C, C++ and Go. It compiles regular expressions to determinisitic finite automata and encodes the automata in the form of a program in the target language. The main advantages of re2c are speed of the generated code and a flexible user interface that allows one to adapt the generated lexer to a particular environment and input model. Re2c supports fast and lightweight submatch extraction with either POSIX or leftmost greedy semantics. Re2c is used in other open-source projects such as php, ninja, yasm, spamassassin, BRL-CAD and wake, etc.

feed Subscribe to receive the latest news and updates. See the user manuals (C, Go) for a complete overview with examples.


You can get the latest release on Github, as well as the older releases. Many Linux distributions and other systems provide their own packages. Re2c source code is hosted on both Github ( and SourceForge ( Github serves as the main repository, bugtracker and tarball hosting. SourceForge is used as a backup repository and email hosting.

Bugs & patches

Please send bugs reports, patches and other feedback to Github issue tracker or email them to and mailing lists. Re2c has an IRC channel #re2c on freenode. Re2c developers are happy to answer questions and provide help. Contributions are always welcome!



Re2c was originally written by Peter Bumbulis ( in 1993. Since then it has been maintained and developed by multiple volunteers, most notably, Brian Young (, Markus Boerger (, Dan Nuffer ( and Ulya Trofimovich ( Other re2c contributors are Derick Rethans, Emmanuel Mogenet, Hartmut Kaiser, jcfp, joscherl, Mike Gilbert, Nerd, nuno-lopes, Oleksii Taran, Peter Bumbulis, Petr Skocik, Paulo Custodio, Ross Burton, Ryan Mast, Serghei Iakovlev, Sergei Trofimovich and Tim Kelly (apologies if someone is missing).


Re2c is in the public domain. The data structures and algorithms used in re2c are all either taken from documents available to the general public or are inventions of the author. Programs generated by re2c may be distributed freely. Re2c itself may be distributed freely, in source or binary, unchanged or modified. Distributors may charge whatever fees they can obtain for re2c. If you do make use of re2c, or incorporate it into a larger project an acknowledgement somewhere (documentation, research report, etc.) would be appreciated. Re2c is distributed with no warranty whatsoever. The code is certain to contain errors. Neither the author nor any contributor takes responsibility for any consequences of its use.


This website describes re2c version 2.0.2.