You could start with
perl -pe 's/,/./g;s/ +/,/g' rules.txt
Thenthen delimit by comma.
Both this in the comment with awk use regular expressions which are the popular tool set for manipulating text.
' +'( +) is a synonym for ' {2,}'( {2,}) both meaning 'two"two or more spaces'spaces".
The "+" is preceded by two spaces but stackexchange inline code blocks do not respect white spaces...