Nginx rewrite rule omit forward slash (/) when its first in encoded url

  nginx, pcre, php, regex

i am trying use Nginx rewrite.
somehow its deletes the / key when its first in string


rewrite rule:

#nginx not relevant conf here
location / {
    rewrite ^(.*)data/([0-9]+)/(.+)?$ $1processor.php?key=$2&data=$3 last;
#nginx not relevant conf here

when i use this rewrite rule for any url i tested it was okay. when i tried url like the example below it somehow omitted the / in the beginning.*-%2B.%60!%40%23%24%25%5E%26*()_%2B%60-%3D%5B%5D%3B%27%5C%2C.%2F%7B%7D%3A%22%7C%3C%3E%3F

when i reloaded nginx with notices and rewrite_log=on; i got the output:

2021/09/25 13:08:29 [notice] 528#528: *11710 "^(.*)data/([0-9]+)/(.+)?$" matches "/data/199/*-+.`[email protected]#$%^&*()_+`-=[];',./{}:"|<>?", client:, server: localhost, request: "GET /data/199/%2F%2A-%2B.%60%21%40%23%24%25%5E%26%2A%28%29_%2B%60-%3D%5B%5D%3B%27%5C%2C.%2F%7B%7D%3A%22%7C%3C%3E%3F HTTP/2.0", host: "", referrer: ""

php (8.0.10) $_GET["data"] output is (as you can see without / thus not exact math):

*-+.`[email protected]#$%^&*()_+`-=[];',./{}:"|<>?

how can i solve it?

Source: Ask PHP