title: What tool to use for this regex
body: <p>I am using a combination of Automator, Bash, and Exiftool to take filenames like this: <code>0615090217.jpg</code> and change the date created to <code>2009:06:15 02:17:00</code>.</p>
  
  <p>Most of the pieces of the puzzle are working, I even have working regex, I just don't know how to apply it using bash or some combination of other tools. I've been seeing sed suggested, but I don't know how to apply it.</p>
  
  <p>The following regex works <a href="http://regexr.com/3cgs3" rel="nofollow">here</a>, but I don't know how to apply it in my setup:</p>
  
  <ul>
  <li><p>Expression: <code>/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(.*)\.[^.]+$/g</code></p></li>
  <li><p>Substitution: <code>\n20$3:$1:$2 $4:$5:00\n\t</code></p></li>
  <li><p>Text: <code>0615090217.jpg</code></p></li>
  </ul>
  
  <p>The shell script in my Automator workflow looks like this:</p>
  
  <pre><code>for f in "$@"
  do
    FILENAME=$(basename "$f")
    MYDATE='2010:07:09 12:22:00'
    /usr/local/bin/exiftool -overwrite_original_in_place -preserve "-AllDates=${MYDATE}" "$f"
  done
  </code></pre>
  
  <p>I want to replace MYDATE with a date extracted from the filename, using my regex or some other method. I feel like I'm close, it's just connecting the final dots.</p>