Does anyone know if there is a nice way to build the Finite State Machine (FSM) of a Ruby regexp ? Assuming the native ruby regexp parser used a (more or less explicit) FSM I first thought that there was some builtin way to access or re-build it but, after reading some reference docs (Regexp class) and posts I can't see any useful methods to do this. But I would be happy to be wrong about this... As an alternative solution, I wonder if someone knows about a module that could parse Ruby regexps (accepting exactly the same regexp grammar as Ruby) and let me read the associated FSM (or whatever graph-like structure representing the regexp). Any help will be greatly appreciated. Thanks sincerely.