diff --git a/docs/proc-uml.svg b/docs/proc-uml.svg
index 34441a3..078e19c 100644
--- a/docs/proc-uml.svg
+++ b/docs/proc-uml.svg
@@ -1,88 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/components/MainVideoStream.vue b/src/components/MainVideoStream.vue
index 1af75bc..7d6bbe7 100644
--- a/src/components/MainVideoStream.vue
+++ b/src/components/MainVideoStream.vue
@@ -6,7 +6,9 @@
v-if="isRerendering"
v-for="captureArea in captureAreas"
:key="captureArea.getId()"
- :stickSize="10"
+ :stickSize="7"
+ :minw="10"
+ :minh="10"
contentClass="draggable-capture-area"
:w="captureArea.getWidth()"
:h="captureArea.getHeight()"
diff --git a/src/proc/Vigad.ts b/src/proc/Vigad.ts
index d5f0a51..a284cef 100644
--- a/src/proc/Vigad.ts
+++ b/src/proc/Vigad.ts
@@ -114,6 +114,8 @@ export class Vigad {
this.regexHandler.findValue(value.data, regexGrp.getValueRegex(), regexGrp.getConstraintRegex()[1]);
} else if (regexGrp.getConstraintRegex()[1].getRegex().toString() === "/(?:)/") {
this.regexHandler.findValue(value.data, regexGrp.getValueRegex(), regexGrp.getConstraintRegex()[0]);
+ } else {
+ this.regexHandler.findValue(value.data, regexGrp.getValueRegex(), regexGrp.getConstraintRegex()[0], regexGrp.getConstraintRegex()[1]);
}
});
}, this.previewWidth, this.previewHeight);
diff --git a/src/proc/regex/Regex.ts b/src/proc/regex/Regex.ts
index 97f6df2..88e130e 100644
--- a/src/proc/regex/Regex.ts
+++ b/src/proc/regex/Regex.ts
@@ -101,6 +101,7 @@ export abstract class Regex {
this.substrings = this.getAllSubstrings(data!);
break;
case Slicing.SPACES:
+ this.substrings = [];
data.split(' ').forEach((element) => {
this.substrings.push({
index: this.indexOfFirst(data),
@@ -109,6 +110,7 @@ export abstract class Regex {
});
break;
case Slicing.ENTIRE_STR:
+ this.substrings = [];
this.substrings.push({ index: 0, element: data });
break;
}
@@ -198,6 +200,7 @@ export abstract class Regex {
},
};
}
+ return true;
});
break;
case Matching.APPROX:
diff --git a/src/proc/regex/RegexHandler.ts b/src/proc/regex/RegexHandler.ts
index b07c096..ea624db 100644
--- a/src/proc/regex/RegexHandler.ts
+++ b/src/proc/regex/RegexHandler.ts
@@ -31,6 +31,10 @@ export class RegexHandler {
* @return {rating: number, match: {index: number, element: string}}
*/
public findValue(data:string, valueRegex: ValueRegex, cRegexBefore?: ConstraintRegex, cRegexAfter?: ConstraintRegex): {rating: number, match: {index: number, element: string}} {
+
+ // replace all occurences of \n in data with spaces
+ data = data.replace(/\n/g, " ");
+
let constraintRegex: ConstraintRegex[] = [];
if (typeof cRegexBefore !== 'undefined') {
constraintRegex.push(cRegexBefore);
@@ -66,13 +70,15 @@ export class RegexHandler {
}
// determine constraint indexes
- let lowestHighIndex = 0;
let highestLowIndex = 0;
+ let hLIPlus = 0; // highestLowIndex plus length of match
+ let lowestHighIndex = data.length;
constraintRegex.forEach(regex => {
switch (regex.getLocation()) {
case "Before":
- if (regex.getLastBestMatch().match.index > highestLowIndex) {
+ if (regex.getLastBestMatch().match.index >= highestLowIndex) {
highestLowIndex = regex.getLastBestMatch().match.index;
+ hLIPlus = highestLowIndex + regex.getLastBestMatch().match.element.length;
}
break;
case "After":
@@ -82,10 +88,6 @@ export class RegexHandler {
break;
}
});
- if (lowestHighIndex === 0) {
- lowestHighIndex = data.length;
- }
-
// set required substrings for value regex & apply similarity conversion
if (highestLowIndex === 0 && lowestHighIndex === data.length) { // if no constraint regex
if (valueRegex.getSlicing() === Slicing.SUBSTR && allSubstrings.length !== 0) {
@@ -96,7 +98,8 @@ export class RegexHandler {
valueRegex.genSubstrings(data);
}
} else {
- valueRegex.genSubstrings(data.slice(highestLowIndex, lowestHighIndex));
+ // this may be cached as well in the future, however performance optimization won't be as high
+ valueRegex.genSubstrings(data.slice(hLIPlus, lowestHighIndex));
}
valueRegex.applySimilarity();