Regulatory mRNA elements or riboswitches specifically control the expression of a large number of genes in response to various cellular metabolites. The basis for selectivity of regulation is programmed in the evolutionarily conserved metabolite-sensing regions of riboswitches, which display a plethora of sequence and structural variants. Recent X-ray structures of two distinct SAM riboswitches and the sensing domains of the Mg(2+), lysine, and FMN riboswitches have uncovered novel recognition principles and provided molecular details underlying the exquisite specificity of metabolite binding by RNA. These and earlier structures constitute the majority of widespread riboswitch classes and, together with riboswitch folding studies, improve our understanding of the mechanistic principles involved in riboswitch-mediated gene expression control.