You can combine characters and expressions to one expression by writing them between round brackets ( and ). Repetitions which are located right behind the bracket ) refer to the whole expression inside the brackets.
There was an example where a appears twice of four times. Using brackets, you can match all even appearances of a.
- a
- aa
- aaa
- aaaa
- aaaaa
- aaaaaa
- aaaaaaaaaaaaaaaaaaaaa
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
If you add brackets around aa, not a is repeated but aa. Thus, all lines mus contain an even number of a.
Next Step