Not wanting to assume that you have already found the relevant docs...
The proxy rewrite specific docs are at: http://httpd.apache.org/docs/2.4/rewrite/proxy.html
and then backtracking to http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html
shows (in the penultimate table of examples) that what you are trying to do (or, more specifically, the syntax you are using) is not allowed...
^localpath(.*) http://thishost/otherpath$1 [P] doesn't make sense, not supported
Might help us help you if you could expand on what exactly you are aiming to achieve