I'm trying out the anchor tokens string end $ and string start ^ from regex as a part of a tutorial. How ever only the string start token works. Obviously in the tutorial both tokens work.
Anchor Token $ (not working)
Input file regex16.txt
foo bar baz
bar foo baz
baz foo bar
bar baz foo
foo baz bar
baz bar foo
Command
grep '.*bar$' regex16.txt
Expected Outcome
baz foo bar
foo baz bar
Outcome
Command od -bc regex16.txt
0000000   146 157 157 040 142 141 162 040 142 141 172 015 012 142 141 162
           f   o   o       b   a   r       b   a   z  \r  \n   b   a   r
0000020   040 146 157 157 040 142 141 172 015 012 142 141 172 040 146 157
               f   o   o       b   a   z  \r  \n   b   a   z       f   o
0000040   157 040 142 141 162 015 012 142 141 162 040 142 141 172 040 146
           o       b   a   r  \r  \n   b   a   r       b   a   z       f
0000060   157 157 015 012 146 157 157 040 142 141 172 040 142 141 162 015
           o   o  \r  \n   f   o   o       b   a   z       b   a   r  \r
0000100   012 142 141 172 040 142 141 162 040 146 157 157 015 012        
          \n   b   a   z       b   a   r       f   o   o  \r  \n        
0000116
Other File
Now after manipulating manually another file regex19.txt looks as the following
0000000   154 151 157 156 012 164 151 147 145 162 012 154 145 157 160 141
           l   i   o   n  \n   t   i   g   e   r  \n   l   e   o   p   a
0000020   162 144 012 146 157 170 012 153 141 156 147 141 162 157 157 012
           r   d  \n   f   o   x  \n   k   a   n   g   a   r   o   o  \n
0000040   142 141 164 012 155 157 165 163 145 012 143 165 143 153 157 157
           b   a   t  \n   m   o   u   s   e  \n   c   u   c   k   o   o
0000060   012 144 145 145 162 012                                        
          \n   d   e   e   r  \n       
But this command still doesn't work, even the example regex16.txt now works after manipulating.
grep '^[a-z]{4,6}$' regex19.txt
Anchor Token ^ (working)
Input file regex15.txt
foo bar baz
bar foo baz
baz foo bar
bar baz foo
foo baz bar
baz bar foo
Command
grep '^foo.*' regex15.txt
Expected outcome
foo bar baz
foo baz bar
Outcome
foo bar baz
foo baz bar