Regex Replace but keep the number

I was looking for a way to replace a common pattern in a URL path and maintain the ID specific integer in the string. I tried a few various options on stack overflow but I kept having the number before .pdf replaced. This regex statement finally worked.

Sample Value:

http://www.example.com/directory/abc_abc_pre11_6.pdf

Desired Value:

http://www.example.com/directory/abc_abc_pre11P6.pdf

Regex Statement:

Find: (\d)_(\d)

Replace: $1P$2