I wanna know why I don't get a result in this case:
echo "This doesn't work." | grep -E '[[:upper:]]([[:upper:]] | [[:lower:]])*\.'
I'm learning regex in Grep and what I'm trying to do here is detect whether the input is a sentence or not. For that I'm using grep with the extended option and trying to match any input that starts with an uppercase letter and is then followed by any number of uppercase and lowercase letters and ends with a period. The thing is that the input doesn't get matched and I can't understand why.
Here's the working example:
echo "This works." | grep -E '[[:upper:]][[:upper:][:lower:] ]*\.'
Also why do we need? the space after [:lower:] in the second bracket expansion before closing it? Why is that required for it to work?