如何反转字符串中的数字并保持字母顺序相同

How can I reverse just the numbers in string of mixed character types (letters, numbers, spaces) but keep the rest of the string in same order?

Example input:

Dlasdf234dkl sdfkl8886adaf15adfjk7  asdflkj376661a s445s198

Example output:

Dlasdf432dkl sdfkl6888adaf51adfjk7  asdflkj166673a s544s891

I tried with some preg_* functions and regular expressions, but I couldn't manage to get the result demonstrated in my output example.

It would be nice to see your regex attempt(s), but I think regex is a good plan. I would maybe think about doing a callback instead of just matching, something like this:

# match digits in the regex
echo preg_replace_callback('/[\d]+/',function($v){
    # reverse string
    return strrev($v[0]);
},$str);