I've had the same challenge and solved it with a tab separated rule file. It could look something like this:
TRANCODE QUANTITY QSIGN KEYCODE HANDLER /(TSP|KSP)/ /^.*(?<!0000000.00000)$/ + /(10|11|20|60)/ se +t(TRAN_CODE, "RCV") /(TSP|KSP)/ * - /(10|11|20|60)/ se +t(TRAN_CODE, "DLV") ...
The table is meant as a lookup table where each value (apart from the values in the rightmost field) are lookup keys that are processed left to right like this:
The different field types have different precedence, so a * will have lower precedence than a regex, which in turn has lower precedence than a literal value.
The rightmost field is just a value that says what to do when matched. It can be a reference to some handler or just a value to insert somewhere.
I do have a module to do this kind of lookup, but it is currently not open source. If you really want it, I can ask the owners if they will let me release it.
In reply to Re: using a config file
by mzedeler
in thread using a config file
by mmittiga17
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |