Convert imperial to metric (but keep imperial in brackets)

Hi all, I would to know if there is a way to automatically convert dimensions from the imperial to the metric system. For example, I have 2'' (or 2 in, it is not constant) in the source segment, and I want to translate it by "51 mm (2 po) " in the target segment. I have thousands of these to translate within the segments (segments are a mix of text, numbers and dimensions), but are never the same, so I need to do a lot of manipulations. If that function doesn't exist, is there an app for this? Thanks