In this part, we are going to focus on hands-on exercises about RegEx rules. We will start by matching email addresses on a given text:
- Let's assume that we have text such as the following, and we would like to catch these email addresses:
- Olgun Aydin, info@olgunaydin.com, Gdansk, Poland
- Olgun Aydin, olgunaydinn@gmail.com, Gdansk, Poland
- Olgun Aydin, olgun.aydin@olgunaydin.com, Gdansk, Poland
- Let's think about this problem. Email addresses have lowercase letters and can have some special characters such as dots
- The pattern looks like this: [some letters] OR [some letters, '.', some letters] @ [some letters] ["."] [some letters]
- We can write our regex rule as follows: (([a-z]+)|([a-z]+\.[a-z]+))@[a-z]+\.[a-z]+
Let's see ...