Regular Expressions with GREP

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

  1. The problem statement, all variables and given/known data:

Given a text file (big_english.txt) containing roughly 250,000 words, answer the following using grep and regular expressions:

  1. For which words are the first three letters the same as the reverse of those letters at the end?

  2. What is the longest palindrome in this dictionary?

  3. Relevant commands, code, scripts, algorithms:

n/a

  1. The attempts at a solution (include all code and scripts):

(What I've got on 16... comes up null, but the question to 17 implies that there should be at least a few hits)

grep -i '^\(\w\)\(\w\)\(\w\)\w\*/\3/\2/\1$' big_english.txt

  1. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):

University of Nebraska at Omaha
Omaha, NE, USA
Dr. Mark Pauley
Advanced Bioinformatics Programming (BIOI 3500)

regex for palindrome. Read and understand

regex - How to check that a string is a palindrome using regular expressions? - Stack Overflow

16 ) you hit null results since you have explicitly escaped the *. It makes the grep command to look for actual 'asterix' in the words.

instead of ::
grep -i '^\(\w\)\(\w\)\(\w\)\w\*/\3/\2/\1$' big_english.txt

make it::

grep -i '^\(\w\)\(\w\)\(\w\)\w*\3\2\1$' big_english.txt

This will return you the list of words having the first three letters repeated in the last three positions with in reverse order with zero or more characters in between.