Validation Plug-In - addMethods in a loop

Validation Plug-In - addMethods in a loop

I have a fair number of regular expressions validation. Instead of manually typing in many addMethods for each regex, I tried using a loop. I have the below simulated struct to hold the regex name, RegExp object and validation message.
function RegExs(exprName, expr, exprVM) {
   
this.exprName = exprName;
   
this.expr = expr;
   
this.exprVM = exprVM;
}

After populating an array of the above, I loop and call addMethod:

for (i in pgRegExs) {

    $

.validator.addMethod(pgRegExs[i].exprName,
       
function(value, element) {
           
return this.optional(element) || pgRegExs[i].expr.test(value);
       
},
       
function(value, element) { return pgRegExs[i].exprVM; }
   
);
}
The validator is picking up the function array, but the last one in the array is applied to every input. So if I have:
pgRegExs = [
 
new RegExs("regExName", regEx, regExMessage),
 
new RegExs("regExName2", regEx2, regExMessage2),
 
new RegExs("regExName3", regEx3, regExMessage3)
];

The regEx3 regular expression is applied to every input, so for example, below, regExName/regEx should be applied to the input field below, but regExName3/regEx3  is used instead.

$("[id$='_field']").rules("add",
   
{
        required
: true,
       
regExName: true,
        messages
: {
            required
: "First name required",
           
regExName: function(value, element) { return regExMessage; }
       
}
   
}
);

Any clues as to why this isn't working? Thanks in advance.