Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: support regex quote meta string (#1290)

Cluase50be110d226
diff --git a/frontend/src/utils/deployment.ts b/frontend/src/utils/deployment.ts
index bdf6d09d5f..3d8e33b6b4 100644
--- a/frontend/src/utils/deployment.ts
+++ b/frontend/src/utils/deployment.ts
@@ -95,6 +95,11 @@ export const buildDatabaseNameRegExpByTemplate = (
labelList: Label[]
): RegExp => {
let regexpString = template.replace("{{DB_NAME}}", "(?<name>.+?)");
+
+ const fixed = template.split(/{{[^{}]+}}/).filter((template) => template);
+ for (const s of fixed) {
+ regexpString = regexpString.replace(s, s.replace(/\W/g, "\\$&"));
+ }
/*
Rewrite the placeholder-based template to a big RegExp
e.g. template = "{{DB_NAME}}_{{TENANT}}"