It is used for pattern matching - recognizing a part of a text that satisfies a certain pattern.