# Example of a non-regular language that is a subset of a regular language?

How can this be? I don't think it is actually possible for a non-regular language to be a subset of a regular language. What examples are there where this is true?

• @Choirbean What context do you think might be required? – David Richerby May 8 '17 at 21:56
• In fact, any infinite (regular) language has a non-regular subset. This can be obtained by forcing "growing gaps" between the length the strings in the chosen subset. – Hendrik Jan May 8 '17 at 22:03
• Don't we have like a dozen duplicates of this? – Raphael May 8 '17 at 22:32
• @Raphael The right column is always helpful: Show that every infinite language has a non-regular subset. – Hendrik Jan May 9 '17 at 0:12

Every language over an alphabet $\Sigma$ is, by definition, a subset of $\Sigma^*$, which is regular. If you want a less trivial example,
$$\{a^nb^n\mid n\geq 0\}\subseteq L(a^*b^*)\,.$$