Regular Expressions Selecting a certain line from a list based on a word in certain location


Example

I have the following list:

1. Alon Cohen
2. Elad Yaron
3. Yaron Amrani
4. Yogev Yaron

I want to select the first name of the guys with the Yaron surname.

Since I don't care about what number it is I'll just put it as whatever digit it is and a matching dot and space after it from the beginning of the line, like this: ^[\d]+\.\s.

Now we'll have to match the space and the first name, since we can't tell whether it's capital or small letters we'll just match both: [a-zA-Z]+\s or [a-Z]+\s and can also be [\w]+\s.

Now we'll specify the required surname to get only the lines containing Yaron as a surname (at the end of the line): \sYaron$.

Putting this all together ^[\d]+\.\s[\w]+\sYaron$.

Live example: https://regex101.com/r/nW4fH8/1