matchRegex

API - useful for checking if an array contains a value

return function
    local msg1 = 'a.ab';
    local msg2 = 'aa.a';
    
    local pattern =(?<=[a-zA-Z0-9#%-_+=])([.])(?=[a-zA-Z]{2,})';
    
    --the pattern first checks for a letter or number before a period
    --then checks for two consecutive letters after a period
    
    local match1 = helper.matchRegex(pattern , msg1);
    local match2 = helper.matchRegex(pattern , msg2);
    
    log(match1); --true
    log(match2); --false

end

Last updated