Trouble creating rewrite rule

Hi Guys,
I’m trying to convert a Rewrite Rule from httpd to haproxy, and can’t firue out a solution, maybe somebody here can halp me?

The Rule looks like that:
RewriteCond %{REQUEST_FILENAME} “.*/foo_.*”
RewriteRule ^(.*)/foo_(.*)$$1/$2 [NC,L,R=301]

It basically changes

I’ve been experimenting with reqrep, but no success so far.