I understand basic regex expressions, but when I see one like this
/^(28|29|[3-5][7]*[0-9])$/
I can’t decipher what it means past a certain point. I get what everything means separately, but together it doesn’t make sense to me, I also don’t understand what the asterik means in this context. Can anyone explain?
Start by separating the pipes, so it matches:
/^28$/,/^29$/or/^[3-5][7]*[0-9]$/The first two are pretty obvious, either 28 or 29 without anything else will be a match, so on the third one:
Begins with the number 3, 4, or 5
[7]*followed by 0-unlimited amount of sevens until[0-9]$which means ending ina number inclusively between 0 and 9.