matches = /^(\[(?:[^A-Za-z]+)?\])/g.exec('[....]#$%%'); if(matches != null && !/\.{4,}/g.test(matches[0])) { }