>> English << | česky | Deutsch | Español ZVON > Tutorials > Regular Expressions Tutorial
>> Example 16 << | Prev | Next | Contents | Regular Expressions

Description


Quantifiers "*", "+", and "?" are special cases of the bracket notation. "*" is equivalent to {0,} (Case 1, Case 2), "+" to {1,} (Case 3, Case 4), and "?" to {0,1} (Case 5, Case 6).

Source


AA ABA ABBA ABBBA

Case 1


Regular Expression: AB*A
First match:AA ABA ABBA ABBBA
All matches:AA ABA ABBA ABBBA

Case 2


Regular Expression: AB{0,}A
First match:AA ABA ABBA ABBBA
All matches:AA ABA ABBA ABBBA

Case 3


Regular Expression: AB+A
First match:AA ABA ABBA ABBBA
All matches:AA ABA ABBA ABBBA

Case 4


Regular Expression: AB{1,}A
First match:AA ABA ABBA ABBBA
All matches:AA ABA ABBA ABBBA

Case 5


Regular Expression: AB?A
First match:AA ABA ABBA ABBBA
All matches:AA ABA ABBA ABBBA

Case 6


Regular Expression: AB{0,1}A
First match:AA ABA ABBA ABBBA
All matches:AA ABA ABBA ABBBA