Replacing two glyphs following by glyph from @class with one glyph

Is there a way to make liga (dliga) replacement like this:

sub (ab)’ @class01 by c;

(ab) is a sequence of glyphs (in my case two hyphens) that needs to be replaced by one glyph in case if (ab) is followed by any glyph from the class01. The question is mostly about syntax to use (if such a replacement is possible at all)


Instead of (ab)’, try a’ b’

Perfect, thanks!