How can i rewrite this?

i want to rewrite:

http://a.com/abcde.jpg
to
http://a.com/ab/cde.jpg

here is my nginx config:
rewrite “^/([a-z]{2})([a-z]{3}).jpg$” /$1/$2.jpg last;

but it not works

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,227397,227397#msg-227397

Hi,

Avoid rewrite’s:

location ~ ^/([a-z][a-z])([a-z][a-z][a-z]).jpg$ {
try_files /$1/$2.jpg $uri;
}

Andrejs

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,227397,227399#msg-227399