Note: I am not sure that my regex's are correct since my textbook at school does not explain/teach regex's of this form but only of the math form such as for DFA's/NFA
I would appreciate any suggestions or hints
Question:
(a) find all occurrences of three letter words in text that begin with `a' and end with 'e';
(b) find all occurrences of words in text that begin with `m' and end with 'r';
My Approach:
a) ^[a][a-zA-Z][e]$ (how to distinguish between 3 letter words and all words?)
b) ^[m][a-zA-Z][r]$
Also I want to use these regex's in linux so would the following command work?:
grep '^[a][a-zA-Z][e]$' 'usr/dir/.../text.txt'
or should I use egrep in this way:
find . -text "*.txt" -print0 | xargs -0 egrep '^[a][a-zA-Z][e]$'