- if(matches[i] < 0 || idx < matchEnd[i] || matchEnd[i] >= str.length()) continue;
- matches[i] = str.indexOf(regExp[i], qMax(matchEnd[i], idx));
- if(matches[i] >= 0) {
- matchEnd[i] = matches[i] + regExp[i].cap(1).length();
- if(matches[i] < minidx) {
- minidx = matches[i];
- type = i;
- }
+ if(matches[i] < 0 || matchEnd[i] > str.length()) continue;
+ if(idx >= matchEnd[i]) {
+ matches[i] = str.indexOf(regExp[i], qMax(matchEnd[i], idx));
+ if(matches[i] >= 0) matchEnd[i] = matches[i] + regExp[i].cap(1).length();
+ }
+ if(matches[i] >= 0 && matches[i] < minidx) {
+ minidx = matches[i];
+ type = i;