const BIC_REGEX = /^[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?$/;

export default {
    isValid(bic: string): boolean {
        return BIC_REGEX.test(bic);
    },
};

export default {
    isValid(bic: string): boolean {
        const bicRegex = /^[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?$/;

        return bicRegex.test(bic);
    },
};

--- 
+++ 
@@ -1,7 +1,7 @@
+const BIC_REGEX = /^[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?$/;
+
 export default {
     isValid(bic: string): boolean {
-        const bicRegex = /^[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?$/;
-
-        return bicRegex.test(bic);
+        return BIC_REGEX.test(bic);
     },
 };
Move the regex definition outside of the function
