title: Joi Validation Regex or pattern
body: <p>I want to joi use regex pattern which define in variable</p>
  
  <p>I have a variable <strong>pattern</strong> which contains regex
  i.e </p>
  
  <pre><code>pattern = "/^[0-9+]{7}-[0-9+]{1}$/"
  </code></pre>
  
  <p>and this pattern send to Joi module and want to confirm</p>
  
  <pre><code>module.exports = {
      save: {
          body: {
            match: Joi.string().regex(pattern).required
          }
       }
   }
  </code></pre>
  
  <p>I know validation work if I use this</p>
  
  <pre><code>module.exports = {
          save: {
              body: {
                match: Joi.string().regex(/^[0-9+]{7}-[0-9+]{1}$/).required
              }
           }
       }
  </code></pre>
  
  <p>But in my case every time regex will different. So I can not use above regex pattern</p>