Reputation: 612
Actually I'm beginner in regex. I managed to do the following:
egrep '[aeiou]\b'
- the last character for each word is a vowel
egrep '^[^ ]+'
- first word of line
But I have no idea how to write regex to match my task. I will be very grateful if you could help me.
Upvotes: 1
Views: 339
Reputation: 627087
You may match the start of a line with ^
, then match any amount of letters using [[:alpha:]]*
and then match the vowel with [aeiuo]
and then assert a trailing word boundary (\b
or \>
):
grep '^[[:alpha:]]*[aeiou]\b'
grep '^[[:alpha:]]*[aeiou]\>'
Tested in Ubuntu:
Upvotes: 3