Hi Alex. Assuming the code (1B18244 in your example) follows a set pattern, you can use a simple GREP pattern to find it and add the suffix. It would look something like this:
Find what:
\d[A-Z]\d{5}
Change to:
$0-X
This finds a single digit (\d), followed by any capital letter ([A-Z]), followed by exactly 5 digits (\d{5}). It then takes the found string ($0) and adds the suffix (-X).
Possible alternative method… In your original question, you mentioned a character style. If every string you’re searching for has the same character style applied, I’d have thought you could also use this to find the string. This seems to work for your example (which has only 7 characters), but when I tried this with longer strings I got unpredictable results. The found string ($0) only grabbed the first part of each string, and the rest got chopped off. I have no idea why it works this way. Perhaps a bug? Or maybe someone else understands what’s going on here.