   Text parsing with boost::regex
  Hello. I am writing a program that would export C++ classes to Luabind. To parse the .h/.hpp files I decided to use boost::regex. However, the documentation is a bit messy and I can't find the way to know the location (inside the string) of the match. How can I know the place of the match inside the sting? Or maybe I should use something else for this task?   
  Hmm... I suspect regular expressions are going to be a bit weak for parsing C++ header files. You'd likely end up having to write a huge amount of state tracking stuff to complement the regexp matching, at which point it's probably just easier to write yourself a recursive-descent parser and expand it to handle the cases you need to support. However, that's going to substantially limit the subset of C++ you can properly handle - C++ is a horrific language to parse.I'd suggest having a quick Google for "c++ parser" and exploring some of the existing options (Elsa and GCC-XML come to mind immediately). Parsing C++ is already a solved problem, so anything you can do to avoid duplicating the (considerable) effort it takes to do C++ parsing correctly is a Good Thing™.   ;  Thank you, I will definetly look into that. However, why isn't such state tracking included into the boost::regex classes (seems extremely simple to add and it would expand the use of regex alot)? It seems to me that this is one of the main purposes of regular expressions: without it boost::regex is unsuitable for any kind of parsing.   ;  By state tracking I mean doing things like checking if you're currently inside a function definition (where certain syntactic expressions are legal) or outside (where they may not be). That level of state is far beyond what regular expressions are meant to do.You may be interested in boost::spirit, which provides a much richer parsing system (it in fact allows you to define full LL* parser grammars) and is far better suited to complex parsing jobs than mere regexps.I would again emphasize, though, that C++ is not an easy thing to parse, and if you want any measure of robustness in your parser, I'd strongly suggest using existing C++ parsers rather than trying to roll your own.   