The regex I need is /^(?!(?:.*?\b\d{7,}\b){4}).+/ and I am storing it as ^(?!(?:.*?\b\d{7,}\b){4}).+ so that I can do a new RegExp(envVariable) and use it. But it comes to my code's environment variable as /^(?!(?:.*?\\b\\d7\\b)4).*?\\b\\d4\\b/ when I bring it to the codebase while building the project. How can I store in in vault so it can be extracted fine ?
You can use base64 encode/decode technique.
Mechanism:
console.log(btoa("^(?!(?:.*?\\b\\d{7,}\\b){4}).+"))
console.log(new RegExp(atob('Xig/ISg/Oi4qP1xiXGR7Nyx9XGIpezR9KS4r')))