Explanation: [character list] matches any one of the characters in the list. ? matches any single character. * matches any number of characters, including none.
Therefore, the wildcard ttyS[1-5] will match any filename that starts with ttyS and ends with a digit from 1 to 5, such as ttyS1, ttyS2, ttyS3, ttyS4, or ttyS5. However, it will not match ttyS0, which has a 0 at the end.
The wildcard tty?[0-5] will match any filename that starts with tty, followed by any single character, followed by a digit from 0 to 5, such as ttyS0, ttyS1, ttyS2, ttyA0, ttyB5, or ttyZ4. This wildcard will match all the given filenames.
The wildcard tty*2 will match any filename that starts with tty and ends with 2, such as ttyS2, ttyA2, ttyB2, or ttyZZZ2. This wildcard will match ttyS2, but not the other two filenames.
The wildcard tty[A-Z][012] will match any filename that starts with tty, followed by a capital letter from A to Z, followed by a digit from 0 to 2, such as ttyA0, ttyB1, ttyC2, ttyZ0, or ttyZ2. This wildcard will match ttyS0 and ttyS2, but not ttyS1, which has a 1 at the end.
The wildcard tty[Ss][02] will match any filename that starts with tty, followed by either S or s, followed by either 0 or 2, such as ttyS0, ttyS2, ttys0, or ttys2. This wildcard will match ttyS0 and ttyS2, but not ttyS1, which has a 1 at the end.