Is there a way to write the following command more concisely?
grep -E '[A-Z](([a-z]{2})|([a-z]{3})|([a-z]{4}))' file.txt
Is there a way to write the following command more concisely?
grep -E '[A-Z](([a-z]{2})|([a-z]{3})|([a-z]{4}))' file.txt
Instead of using an alternation | for every quantifier {2}, {3}, {4} in a separate capturing group you could use a single quantifier {2,4} and a single capturing group.
grep -E '[A-Z]([a-z]{2,4})' file.txt
About the pattern
[A-Z] Match single char A-Z( Capture group 1
[a-z]{2,4} match 2-4 times a-z) Close group