Have you considered shift-based DFA for a portable implementationhttps://gist.github.com/pervognsen/218ea17743e1442e59bb60d29b1aa725 ?
Vladimir
>