in reply to
grep regex exact match last n positions
You seem to want
/ \Q$search\E\z/
[download]
Comment on
Re: grep regex exact match last n positions
Download
Code
In Section
Seekers of Perl Wisdom