# Step by step method for generating Regular Expressions for languages [duplicate]

I was wondering if there was a method that can be used to generate a Regular Expression for a language. Take the Language $L$ as an example where:

$L= \{w \in \{0, 1\}^{\ast} \mid \text{length of } w \text{ is a multiple of } 2 \text{ or } 3\}.$

Can you show the step by step method to make the RE for this language? Cheers

• In general? No, because that would imply you could algorithmically decide whether a given language is regular (impossible). Of course, there are certain methods, e.g. build an NFA and convert it. (Community votes, please: duplicate?) – Raphael Jan 16 '16 at 15:33
• Anyway, what have you tried and where did you get stuck? – Raphael Jan 16 '16 at 15:34

Hint: Let's denote $w_{\text{two}}$ words with length that is a multiple of $2$
and $w_{\text{three}}$ words with length that is a multiple of $3$
$$|w_{\text{three}}|\bigg|_{3}\cup|w_{\text{two}}|\bigg|_{2}$$