title: Elasticsearch string based query to match a regular expression
body: <p>I would like to know if it is possible to make a string based query to match a regular expression in elasticsearch. </p>
  
  <p>I know it is possible the other way around (make a regex query to match a string in a elasticsearch document) but can I make a query based on a string and match a regular expression saved in the document with elasticsearch ?</p>
  
  <p>For instance, I have a document filled with data including an input (the regular expression) and an output (describing the regular expression) as below :</p>
  
  <pre><code>{
    "input": "[0-9]+ ?kg",
    "output": "weight"
  }
  </code></pre>
  
  <p>Can I make a query with the string "67kg" in order to match the regex and get this :</p>
  
  <pre><code>{
    "took" : 1,
    "timed_out" : false,
    "_shards" : {
      "total" : 5,
      "successful" : 5,
      "skipped" : 0,
      "failed" : 0
    },
    "hits" : {
      "total" : 1,
      "max_score" : 1.0,
      "hits" : [
        {
          "_index" : "test1",
          "_type" : "type",
          "_id" : "XqXucGgBXOzlaMdqiLcI",
          "_score" : 1.0,
          "_source" : {
            "input" : "[0-9]+ ?kg",
            "output" : "weight"
          }
        }
      ]
    }
  }
  </code></pre>