CommonRegex port for Ruby.