This wheel has already been invented.
In reply to Re: s/// treat rhs as regex by jwkrahn in thread s/// treat rhs as regex by chuckH