This paper presents a case of patterned exceptionality. The case is Tagalog nasal substitution, a phenomenon in which a prefix-final nasal fuses with a steminitial obstruent. The rule is variable on a word-by-word basis, but its distribution is phonologically patterned, as shown through dictionary and corpus data. Speakers appear to have implicit knowledge of the patterning, as shown through experimental data and loan adaptation. A grammar is proposed that reconciles the primacy of lexical information with regularities in the distribution of the rule. Morphologically complex words are allowed to have their own lexical entries, whose use is preferred to on-the-fly morphological concatenation. The grammar contains lowerranked markedness constraints that govern the behavior of novel words. Faithfulness for lexicalized full words is ranked high, so that an established word will have a stable pronunciation. But when a word is newly coined through affixation, the outcome varies according the lexical trends. A crucial aspect of the proposal is that the ranking of the "subterranean" markedness constraints can be learned despite training data in which all words are pronounced faithfully, using Boersma's (1997Boersma's ( , 1998 Gradual learning algorithm. The paper also shows, by summarizing the rule's behavior in related languages, that the same constraints, in different rankings, seem to be at work even in languages reported to lack variation.