Wildcard in Contextual Alternates – Real alternation

I’ve been playing with a concept where every other period (in a longer text) is a contextual alternate, and followed the tutorial series on how to solve it. Currently it ‘works’ as a principle based on the tutorial, but since the usecase is slightly different, I’ve hit a dead end in terms of how to make this work.

The Calt-script does it’s job when ‘period period’, ‘period [character] period’ and ’period [character] [character] period’ occurs. As illustrated, it breaks on the last example, because I’ve not set up a Calt code for ‘when there’s three characters in between periods.

However, setting this up for a real life scenario where the user could write extensively between each period, I’m looking for a method to insert some sort of wildcard that says ’period [anything between] period’. Or simply: Look through the text, and replace every second period. I’m struggling to find any resources on the coding part of this, and the tutorial only got me this far.

Any ideas as to resources to read up on – or if anyone knows a snippet that would solve this?

I would like to know if this is possible as well. I have encountered a similar problem in my own font.

As far as I know, this is not possible with OpenType.

You cannot use a wildcard, but you can make a glyph class that contains all glyphs except period period.ss01 and use that.