What is the difference between encasing part of a regular expression in () (parentheses) and doing it in [] (square brackets)?
How does this:
[a-z0
(…) is a group that groups the contents like in math; (a-z0-9) is the grouped sequence of a-z0-9. Groups are particularly used with quantifiers that allow the preceding expression to be repeated as a whole: a*b* matches any number of a’s followed by any number of b’s, e.g. a, aaab, bbbbb, etc.; in contrast to that, (ab)* matches any number of ab’s, e.g. ab, abababab, etc.
[…] is a character class that describes the options for one single character; [a-z0-9] describes one single character that can be of the range a–z or 0–9.