Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Runtime Regexp Generationby l2kashe (Deacon) |
on Apr 14, 2003 at 18:35 UTC ( [id://250370]=note: print w/replies, xml ) | Need Help?? |
Personal preference is when regexen get this large to either A) build them in steps, or B) use something else.. here is a basic filter using basic logic and tests...
I usually place a sample data line or 2 in my source file, so that people who come along after me know what elements im working on, or they can compare the data being passed to the code, vs the data the code is assuming it is receiving and go "duh.. we upgraded app X, need to alter the filter.." I know the question was how to get a regex to match, but personally in this situation, I think it might be better to move away from the regex, as it makes the code clearer and easier to maintain.. almost update: I guess you could also alter the split to only return the items you will ever search on, but I tend to attempt to not dictate what possible uses the code may have in the future.. A slightly better split might be something like
MMMMM... Chocolaty Perl Goodness.....
In Section
Seekers of Perl Wisdom
|
|