in reply to Regex with variables

Quick hint: Text::Template. Take a look at this module and see if it may fulfill some, at least, of your needs.

Replies are listed 'Best First'.
Re^2: Regex with variables
by eshafto (Novice) on Apr 26, 2011 at 01:10 UTC

    I suppose that was predictable. In fact, from the documentation for Text::Template...

    When people make a template module like this one, they almost always start by inventing a special syntax for substitutions. For example, they build it so that a string like %%VAR%% is replaced with the value of $VAR.

    Ha! I started using %-VAR-% after the second iteration. That's COMPLETELY different.

    Then they realize the need extra formatting, so they put in some special syntax for formatting. Then they need a loop, so they invent a loop syntax. Pretty soon they have a new little template language.

    Okay, so I hadn't gotten to the looping part. Anyway, it looks like Text::Template will do exactly what I need, better than I was going to do it, and I could have saved myself a day and a half if I had thought to look for it first. I honestly hope I am able to forgive you someday :-)

    Thanks for the quick and helpful reply.