generalized \rx to work with python or ruby