title: PHP: Regex JSON file for image names
body: <p>I am trying to get all the image names and extensions from a json file. </p>
  
  <p>Currently I have the following pattern:</p>
  
  <pre><code>$pattern = '/(.*).jpg/i';
  </code></pre>
  
  <p>When I run the php for this I get the following output:</p>
  
  <pre><code>[1506] =&gt; "saturday.jpg
  [1507] =&gt; "friday.jpg
  [1508] =&gt; "monday.jpg
  [1518] =&gt; "image": "ten-pound.jpg
  [1519] =&gt; "image": "hundred-fifty-pounds.jpg
  [1520] =&gt; "image": "six-pound-fifty.jpg
  [1568] =&gt; "answer": "thursday.jpg
  [1633] =&gt; "answer": "london.jpg
  </code></pre>
  
  <p>I do not want anything but the image names. So not the <code>"image"</code> or <code>"answer":</code> or even the beginning <code>"</code></p>
  
  <p>What I ideally want is all the images to be output into an array like so:</p>
  
  <pre><code>$images = {"saturday.jpg","monday.jpg","ten-pound.jpg"}
  </code></pre>
  
  <p>Any thoughts?</p>