# Regular expression for containing 010 as a subword

I am studying for a test in computer science, and am encountering difficulties with regular expression. Here is example of a question I don't understand.

I managed to solve the following question:

Give a regular expression for the language of all words over $$\{a,b\}$$ which contains one of $$aa,bb$$ as a subword.

My solution: $$(a ∪ b)^*(aa ∪ bb)^*(a ∪ b)^*.$$

I am having trouble with the following question:

Give a regular expression for the language of all words over $$\{0,1\}$$ which contains $$010$$ as a subword.

• L1 does not look right. All the words in L1 are such that "aa" or "bb" occurs as a substring, but not all words that satisfy the above property are in L1. – Steven Nov 8 '19 at 22:00
• cs.stackexchange.com/q/1331/755 – D.W. Nov 8 '19 at 23:48
• What do you mean by "subword"? – Yuval Filmus Nov 10 '19 at 11:27