title: get wildcards in pattern as specific variables with preg_match
body: <p>I am trying to get specific information out of an input string into variables by using wildcards in a match pattern.</p>
  
  <pre><code>$input   = "my name is John Smith and I live in Las Vegas";
  $pattern = "my name is * and I live in *";
  </code></pre>
  
  <p>I understand preg_match will give me all wildcards with (\w+), so replacing * in the pattern with (\w+) gives me "John Smith" and "Las Vegas" but how would I go about giving a variable name in the pattern so I can do</p>
  
  <pre><code>$pattern = "my name is *name and I live in *city";
  </code></pre>
  
  <p>and get the result put into variables like so:</p>
  
  <pre><code>$name = "John Smith"
  $city = "Las Vegas"
  </code></pre>
  
  <p>any help to find the corresponding preg_match pattern will be highly appreciated! Also I wonder if the * character is a wise choice. Maybe $ or % makes more sense. </p>