in reply to Re: regex for rpm: name, version, release, arch
in thread regex for rpm: name, version, release, arch

Can you not use rpm queryformat option to do all the work for you?
rpm -qa --qf "%{n},%{v},%{r},%{arch}\n"