Standards are sets of technical guidelines published by standards-developing organizations (SDOs).
Regulations (such as the Code of Federal Regulations) are administrative laws of regional and federal government agencies of the United States or other countries.
When a government regulation requires a certain standard be followed, that standard technically becomes a law. SDOs tend to refer to these standards as incorporated by reference (IBR). Other people more commonly refer to IBR standards as codes.
So a code is very much like a standard, except that is has been officially adopted by a governmental body. Following regular standards may be expected, but is ultimately voluntary. Following codes is legally mandatory.
Note: Although there are many publications called codes--such as The National Electrical Code and the ASME Boiler and Pressure Code--not every legally-mandated standard is called a code or exists as a stand-alone publication.