in reply to Multiline string and one line comments

Using regexes for such a job might be asking too much from regexes. I think you should probably think of a parser. You could write a minimal parser yourself (probably using regexes among other things, but the driving idea should be to parse the input, i.e. separate the tokens and and analyze them one by one) or use an existing parsing module and just write the grammar and the code to call and use it.

As an example, you could use Damian Conway's Parse-RecDescent module: http://search.cpan.org/~jtbraun/Parse-RecDescent-1.967009/lib/Parse/RecDescent.pm. There may be some more lightweight packages, but I do not know them.

  • Comment on Re: Multiline string and one line comments

Replies are listed 'Best First'.
Re^2: Multiline string and one line comments
by AskandLearn (Initiate) on Apr 18, 2014 at 03:15 UTC

    Yes I agree, took me a while to realize. I got my own solution just by plain scripting. Thanks for pointing it out.