To put this in context, consider these 2 functions: ml_RestrictToChars = function(input,regex) { var result = \'\';var c = \'\';