I think that
Regexp::Genex might be of interest ... but note that what you're asking is an impossible task, as there are an infinite number of patterns that match
/[^\\]+/ since it's a one-or-more match and is unbounded ... (i'm assuming Regexp::Genex has some protection against that)