Skip to content

Commit

Permalink
Changed cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
alordash committed Aug 21, 2021
1 parent 7ba7cfa commit a8f2e6d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/regex-extractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ const { distance } = require('@alordash/damerau-levenshtein');
function extractRegexChars(words, errorLimit = 1) {
let expressions = [];
const parsingRules = LoadExpressions();
let k = words.length;
while (k--) {
for (let k = 0; k < words.length; k++) {
let word = words[k].text;
let match = word.match(/[,.;:!?]/);
if (match != null && (match.index + match[0].length == word.length)) {
Expand Down Expand Up @@ -45,7 +44,7 @@ function extractRegexChars(words, errorLimit = 1) {
if (!found) {
expression = new Expression(words[k].text, '.', 0, 0, 0, undefined, words[k]);
}
expressions[k] = expression;
expressions.push(expression);
}
return expressions;
}
Expand Down

0 comments on commit a8f2e6d

Please sign in to comment.