使用Ragel在Golang中两个正则表达式的交点

The template of the function is as follows:

func GetIntersection(firstRegex string, secondRegex string) string {
    ...
}

I'm trying to use Ragel to get the intersection of two regular expressions. Not sure if Ragel is the right tool to use, though. My last resort is implementing conversions from regex to DFA and DFA to regex, as well as intersection of two DFA's myself, but I would rather avoid that. Would highly appreciate any reliable libraries to solve the problem.

Ragel has an intersection operator (&). You can produce the intersection of any two regular expressions, so long as they are expressed in the ragel syntax. There is no freely available automatic ragel-to-regex translation. This is the kind of thing I've been producing for clients privately. Anyhow, see the manual for more information on intersection.