A regular expression, or simply regex, allows us to look for general patterns in text data. For example, if we are looking for an email or phone number in a large document then we can define the pattern and extract all the available emails and phone numbers present in the document using regex. Regular expressions have a standardized set of rules for defining the pattern irrespective of the programming language. They are used widely and are an extremely powerful way to work with text data. Using some of these rules, we can define the phone pattern in regular expression as –  ^[6-9]\\d{9}$  The ‘^’ marks at the beginning should be with the characters present in the square bracket where 6-9 means any number out of 6, 7, 8, and 9. These four numbers should be present in just one. Following this ‘\\d’ means any digit and ‘{9}’ means repeated exactly 9 times. Therefore, the complete pattern describes that the matching string should start with a number 6, 7, 8, or 9 followed by 9 other digits, totalling 10 digits of a phone number.