The answer ncw gave on how to join the patterns into a regex is just right--you have nice, simple patterns.
Are you interesting in something that applies one regex to a one sort of log file and another regex to another sort? If so, you're nearly there. If you can parse the input filenames (or the output filenames, come to think of it) to get a unique string corresponding to each type of file you want to edit, then you could put the pattern into a hash based on the string you parsed out of the file names. If you don't have many types of files, that's a good solution.
If you have a _lot_ of types of files, or if the regex is going to change a lot, I'd consider biting the bullet and writing a config file. Then, once you've parsed the file name, get the regex for that type of file from the config.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.