Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,23 @@ function regexMatch(input, regex) {
return null;
}

var regexp = new RegExp(regex, "g");
var match = regexp.exec(input);
if (regex) {
var regexp = new RegExp(regex, "g");
var match = regexp.exec(input);

while (match != null && match[0] != '') {
var index, v;
while (match != null && match[0] != '') {
var index, v;

if (match.length == 1) {
index = 0;
} else { index = 1; }
if (match.length == 1) {
index = 0;
} else { index = 1; }

while (index < match.length) {
v = match[index];
result.push(v)
index++;
}
while (index < match.length) {
v = match[index];
result.push(v)
index++;
}
}

match = regexp.exec(input);
}
Expand Down