上QQ阅读APP看书,第一时间看更新
Unary operator for repetition
The *, +, and ? symbols are known as unary operators, which are used to specify repetitions in regular expressions. They are also known as modifiers. For example, we can use the unary operator for repeating character classes. However, the important thing is it repeats entire character class and not just the character it matched. The [0-9]+ regular expression can match one or more digits; it can be 987654321, or 222, or 333, and so on.