in reply to Replacing consecutive tokens in 1 pass

You need a zero-width positive look-ahead assertion.
s{\|9[0-6](?=\|)}{|X}g;

The (?=\|) tells the regex engine to look for (but not act upon) the vertical bar.