in reply to Help with regex for complicated key=value string

If this is an ongoing project that will need quite a bit of maintenance, I'd consider writing the lexer with lex and the parser with yacc. That'd give you a C parser you could then use via a wrapper from Perl or another wrapper from Python. This solution of course assumes a few things.

Another thing I'd consider is that unless I had some specific requirement for two complete single-language solutions, I might write the parser in only Perl. The parser could read and parse the input format and write out an intermediate representation suited to the application. That format could be made to be trivial for both the Python and Perl back-ends to access. Perhaps a file delimited with colons, tabs or nulls would work. Maybe a properly formatted CSV file would be suitable. Perhaps XML, YAML (does Python do YAML?), JSON, or maybe even a database would be good.

  • Comment on Re: Help with regex for complicated key=value string