Skip to content

🔥 The free & Open Source DocuSign alternative

fix: input regex validation issue

RaktimaNXG0fe793780831
diff --git a/microfrontends/SignDocuments/package-lock.json b/microfrontends/SignDocuments/package-lock.json
index 7841c8fe4..7ff11f516 100644
--- a/microfrontends/SignDocuments/package-lock.json
+++ b/microfrontends/SignDocuments/package-lock.json
@@ -40,6 +40,7 @@
"react-select": "^5.8.0",
"react-signature-canvas": "^1.0.6",
"reactour": "^1.19.1",
+ "regex-parser": "^2.3.0",
"web-vitals": "^2.1.4"
}
},
@@ -18471,9 +18472,9 @@
}
},
"node_modules/regex-parser": {
- "version": "2.2.11",
- "resolved": "https://registry.npmjs.org/regex-parser/-/regex-parser-2.2.11.tgz",
- "integrity": "sha512-jbD/FT0+9MBU2XAZluI7w2OBs1RBi6p9M83nkoZayQXXU9e8Robt69FcZc7wU4eJD/YFTjn1JdCk3rbMJajz8Q=="
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/regex-parser/-/regex-parser-2.3.0.tgz",
+ "integrity": "sha512-TVILVSz2jY5D47F4mA4MppkBrafEaiUWJO/TcZHEIuI13AqoZMkK1WMA4Om1YkYbTx+9Ki1/tSUXbceyr9saRg=="
},
"node_modules/regexp.prototype.flags": {
"version": "1.5.1",
diff --git a/microfrontends/SignDocuments/package.json b/microfrontends/SignDocuments/package.json
index a1f9984c3..aa8f72a0b 100644
--- a/microfrontends/SignDocuments/package.json
+++ b/microfrontends/SignDocuments/package.json
@@ -36,6 +36,7 @@
"react-select": "^5.8.0",
"react-signature-canvas": "^1.0.6",
"reactour": "^1.19.1",
+ "regex-parser": "^2.3.0",
"web-vitals": "^2.1.4"
},
"scripts": {
diff --git a/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.js b/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.js
index 7751dd0e6..a2133ad15 100644
--- a/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.js
+++ b/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.js
@@ -3,6 +3,7 @@ import { onChangeInput } from "../../utils/Utils";
import DatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";
import "../../css/signature.css";
+import RegexParser from "regex-parser";
function PlaceholderType(props) {
const type = props.pos.type;
@@ -18,8 +19,12 @@ function PlaceholderType(props) {
});
const validateExpression = (regexValidation) => {
- const regexObject = new RegExp(regexValidation);
+ let regexObject = regexValidation;
+ if (props.pos?.options.validation.type === "regex") {
+ regexObject = RegexParser(regexValidation);
+ }
+ // new RegExp(regexValidation);
let isValidate = regexObject.test(textValue);
if (!isValidate) {
props.setValidateAlert(true);