HAProxy ACL's - Support of Arithmetical Operations

I am trying to implement a logic as below to route the requests across different backends depending on if some part of the URL is “odd” or “even” number. The logic is described as below:

  • Parse the URL and find the Id.
  • If Id even number (id%2 == 0) then route the request to “backendX”. Else route to “backendY”.

Sample URI: http://api.example.com/devices/demo-devices/{id}

Is it possible to implement such a logic as explained above using the ACL’s?

If yes - is it supported as part of the community version?
If no - are there are any alternate approaches?