I have a javascript function maxRepeat. Im having trouble translating it to vb.net, seems regex engine differs...and Im not so strong on regex. Would you mind pointing me in the right direction for translating the regex string to the appropriate vb.net one ? ...I understand how to do the logic afterwords, just lost on the regex string...
Im talking about this function..
function maxRepeat(input) {
var reg = /(?=((.+)(?:.*?\2)+))/g;
var sub = "";
var maxstr = "";
reg.lastIndex = 0;
sub = reg.exec(input);
while (!(sub == null)) {
if ((!(sub == null)) && (sub[2].length > maxstr.length)) {
maxstr = sub[2];
}
sub = reg.exec(input);
reg.lastIndex++;
}
return maxstr;
}
This functions returns the largest sequence of characters that appear at least twice. "one two one three one four" would return "one t" <--with space || "onetwoonethreeonefour" would return "onet"
"324234241122332211345435311223322112342345541122332211234234324" returns "1122332211234234"