title: Use NGINX rewrite variable as array of chars?
body: <p>So after migration from pretashop 1.4 -> 1.6 all images folders structure move from /img/p/*-*.jpg to /img/p/*/*/*/*... </p>
  
  <p>In same products description we have image links to old structure and I just want to make rule.</p>
  
  <p>Exmaple old structure: /img/p/1256-5097.jpg</p>
  
  <p>From this url I can get id 5097, but to use it in new image foldes I neet to split it to img/p/5/0/9/7/5097.jpg</p>
  
  <p>Can I get(split) id using just nginx rewrite module?  </p>