Using Rules (Regular Expressions) to Load Grids


If Enable Grid Rules is enabled (on the GridLines->Options menu), V will look for a .rules file which contains a list of file expressions and corresponding .vgrid files to load if the currently viewed file matches that expression.


You will need to create a file called .rules in the Default Grid Directory (select Set Default Grid Directory from the GridLines menu). This file must be created manually with an editor (you cannot use V to create it).


Each line in this file (.rules) consists of a regular expression followed by a replacement string (separated by a "/").


When viewing a file, V will try to match the file name against each expression in .rules. If it finds a match, it tries to load the .vgrid file specified by the replacement.


For example, let's say that a directory consisted of many files named Test1-YYYY-MM-DD.log and Test2-YYYY-MM-DD.log where YYYY-MM-DD represented the date the file was created.


You could apply a single .vgrid file for all such files by adding the following line to ".rules":




This will cause V to load Test.vgrid for any file of the form Testxxxxx.log.


If you wanted to load a different grid for Test1 and Test2 files, you could add the following line to .rules:




This would load Test1.vgrid for all file names that started with Test1, Test2.vgrid for all file names that started with Test2, and so on, up to Test9.vgrid.




The expressions in .rules must be regular expressions - which are different from simple Windows/DOS wildcard expressions (like Test*.log  - which will not work).


Any lines in .rules that begin with either # or ; are ignored (they can be used for comments).