基于特定的子目录using.htaccess重写url

I am wondering whether it's possible to use .htaccess to search for a particular folder that starts with a number and redirects internally without changing the URL in the browser.

Lets say I have a url like:

www.example.com/api/rest/3.22/user

Now I want to rewrite the url internally to (for example)

www.example.com/api/rest/3.0/user

Note: Only the 3.0 folder available in server and 3.22 is just a name.

I tried with the following one,but it not helps.

RewriteRule ^api/rest/3\.22/$ /api/rest/3.0/$1

Try this rule in your root .htaccess:

RewriteRule ^(api/rest)/(?!3\.0/)[\d.]+/(\w+)$ /$1/3.0/$2 [L,NC]