|Just another Perl shrine|
Re: Regex ANDby ady (Deacon)
|on Dec 02, 2004 at 14:16 UTC||Need Help??|
A little more background on the domain of this problem:
I've written a tool (in Perl) for transforming data on enterprise applications (modules & relations) to an input format for graphic display (nodes & arcs).
The node names have the general format:
Part of the tool allows you to enter a regex (in a textbox), the program compiles the regex and uses it as a filter to parse the data (eg. discard data line if node-name !~ node-filter).
For instance you can specify the following regex:
to indicate that you're only interested in source modules matching the following name conventions (which is an example of an actual application domain) :
Now it's also often relevant to filter on nodes NOT matching a given application domain (in effect the complement of the domain definition), - for the above example all modules which pass a filter combining the following regex'es:
Thus the need to combine (AND) the "negated" rexeg'es into one big regx and pass that to the parsing/filtering program.