Background
I have a site that stores archived data extracted from an old application environment (Lotus/IBM Notes). The data is stored as lots of individual .pdf files, 1 per record from the old application. Lotus Notes provided a 'doclink' feature that creates links between records, in the extracted .pdf files these are represented as URL links. Unfortunately the links don't work because they just reference the GUID of the record rather than the filename of the .pdf.
Example
Link is: http://server/site/content/4A2581B4000053274A25797C002B23F8.pdf
When clicking on a link you are taken to the 404 'Page Not Found' page.
Solution
I'd like to customise this page to include a 'Search Results' web part with a query that just searches for that GUID.
I've managed to create a custom 404 page with the 'Search Results' web part, but cannot find a way to extract just the GUID value from the url parameter [requestUrl] that is passed to the 404 page.
Question
Is it possible to perform any text parsing on the query string parameters to help filter out the GUID?