good chemistry is complicated,
and a little bit messy -LW
Apply A Set Of Regexes To A Stringby Cody Pendant (Prior)
|on Oct 11, 2004 at 01:58 UTC||Need Help??|
Cody Pendant has asked for the
wisdom of the Perl Monks concerning the following question:
I'm working on the reformatting of a number of documents.
I not only have to repetitively apply a number of regexes to a number of pages, but apply some regexes to some pages and not others.
There's no right or wrong answer of course, but how might Monks go about this in an organised and maintainable way, apart of course from the straightforward process of just doing:
and the variation
Would monks for instance use a data structure like this:
or even this:
and then iterate through them? Would you create a sub and feed it the RHS and LHS as arguments every time? Or just a for() loop?
I'd be interested in Monkly opinions.