Is the language $L = \{\omega : \omega\text{ contains exactly one 'foobar'}\}$ regular? I have a hunch that it is non-regular because a regular expression representing the language must remember that is has encountered the substring 'foobar.'
However, I can't seem to use the pumping lemma to prove that it is indeed not regular. Say $s \in L$ and $s$ is of the form
[substring not containing 'foobar']foobar[substring not containing 'foobar'].
Then, $L$ is pumpable because $s = xyz \in L$ for $|s| > p$, where $y$ can be a substring within either section labeled [substring not containing 'foobar']
. If we repeat $y$ $j$ times, $xy^jz$ will still be in $L$.
However, again, $L$ doesn't seem regular to me... why is my pumping lemma proof erring?