This seems correct to me. (Even thought I'm not a whiz in regular expressiony myself)
But here's a good tutorial you could check out. This one I found useful as well.
Frage
I'm just learning regular expressions, so I just want to make sure my understanding is correct.
01*
mean 0 followed by 0 or more repetitions of 1.
1* + 01*
means either 0 or more repetitions of 1 OR 0 followed by 0 or more repetitions of 1.
Am I right or is there something that I'm missing? Thanks.
Andere Tipps
The + in a regex doesn't mean OR but "one or more of"
So instead of 1* + 01* you would say:
1*|01*
which would mean either a (maybe zero length) string of ones, or a zero followed by (maybe a zero length) string of ones.
So it would match any of:
1
1111
0
011
But none of:
101
110
100001
001
00
The OR operator (vertical pipe) has a low precedence.