This looks like what I need. Unfortunately, I don't know a damn about regular expressions. I'll figure it out in time I guess... Thanks for pointing this out.This is what you are looking for: https://xenforo.com/community/resources/post-content-find-replace.5748/
I hope you've got good Regex chops!
Refer to the v1.x version for documentation: https://xenforo.com/community/resources/post-content-find-replace.1549/
Alternatively, look at hand-coding some redirect scripts which make those old URLs valid and redirect to XF URLs - then you don't need to fix the old links.