Nginx位置正则表达式

I have some different request to one file

https://smska.net/stubs/handler_api.php?api_key=583ada77a8e53f4ee7fb2307f550ca33&action=getBalance

https://smska.net/stubs/handler_api.php?api_key=582ada54a8e59f4ee7fb8a01f530ca55&action=getNumber

https://smska.net/stubs/handler_api.php?api_key=553ada54a8e53f7ee7fb8a07f550ca23&action=getStatus

I want confirm rules on everyone of them. Have rules

location /stubs/ {
location ^~ getBalance {

But location getBalance dont work :(

How I can point some location one file but dependind on keyword in request ?

Unfortunately, because of your bad English I don't fully understand what you want, but I'll try to help you. You'd better translate the text using the Google Translate website.

Well, since your question is tagged as regex, I suppose you want to match a line contains a certain string. So, you can use the regular expression /^.*\=getBalance/m in php.

preg_match_all("/^.*getBalance/m", $string, $matches);
print_r($matches, false); // the second param is set to false by default

Check it out: https://regex101.com/r/mzzY3n/1