@abaplint/runtime 2.13.26 → 2.13.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,12 +4,16 @@ exports.match = match;
|
|
|
4
4
|
const string_1 = require("../types/string");
|
|
5
5
|
function match(input) {
|
|
6
6
|
const val = typeof input.val === "string" ? input.val : input.val.get();
|
|
7
|
+
const regexInput = input.pcre || input.regex;
|
|
8
|
+
if (regexInput === undefined) {
|
|
9
|
+
throw "match() requires either regex or pcre parameter";
|
|
10
|
+
}
|
|
7
11
|
let reg = "";
|
|
8
|
-
if (typeof
|
|
9
|
-
reg =
|
|
12
|
+
if (typeof regexInput === "string") {
|
|
13
|
+
reg = regexInput;
|
|
10
14
|
}
|
|
11
15
|
else {
|
|
12
|
-
reg =
|
|
16
|
+
reg = regexInput.get();
|
|
13
17
|
}
|
|
14
18
|
const r = new RegExp(reg);
|
|
15
19
|
const res = val.match(r);
|
|
@@ -38,11 +38,12 @@ function replace(input) {
|
|
|
38
38
|
if (sub !== undefined) {
|
|
39
39
|
sub = abap_regex_1.ABAPRegExp.escapeRegExp(sub);
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const regexInput = input.pcre || input.regex;
|
|
42
|
+
if (typeof regexInput === "string") {
|
|
43
|
+
sub = new RegExp(abap_regex_1.ABAPRegExp.convert(regexInput), "g");
|
|
43
44
|
}
|
|
44
|
-
else if (
|
|
45
|
-
sub = new RegExp(abap_regex_1.ABAPRegExp.convert(
|
|
45
|
+
else if (regexInput) {
|
|
46
|
+
sub = new RegExp(abap_regex_1.ABAPRegExp.convert(regexInput.get()), "g");
|
|
46
47
|
}
|
|
47
48
|
if (input.off && input.len && typeof input.val === "string") {
|
|
48
49
|
const offset = input.off.get();
|