Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

99
Views
Can we store regex as an environment variable in vault?

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 ?

almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use base64 encode/decode technique.

Mechanism:

  1. Encode your regex string with base64

console.log(btoa("^(?!(?:.*?\\b\\d{7,}\\b){4}).+"))

  1. Save this string to vault
  2. Decode string and create regexp from it.

console.log(new RegExp(atob('Xig/ISg/Oi4qP1xiXGR7Nyx9XGIpezR9KS4r')))

almost 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!