Comment how the regex reverse search while works

This commit is contained in:
Daniel Imms
2018-12-26 16:12:53 -08:00
parent 1a1f7e984f
commit d698faa183
+1
View File
@@ -207,6 +207,7 @@ export class SearchHelper implements ISearchHelper {
const searchRegex = RegExp(searchTerm, 'g');
let foundTerm: RegExpExecArray;
if (isReverseSearch) {
// This loop will get the resultIndex of the _last_ regex match in the range 0..col
while (foundTerm = searchRegex.exec(searchStringLine.slice(0, col))) {
resultIndex = searchRegex.lastIndex - foundTerm[0].length;
term = foundTerm[0];