in reply to perl indication of end of string already matched

I am confused also. This appears to be a very contrived example. Can you show some code closer to your actual application?

For your regex, just keeping track of last vs curr pos would seem to do it. $ matches when pos does not advance.

use warnings; use strict; my $str = "abc"; my $last_pos =0; while ($str =~ m/.|$/gc) { my $curr_pos = pos($str); printf("1: %d", $curr_pos); ($curr_pos == $last_pos) ? print " EOString\n" : print "\n"; $last_pos = $curr_pos; } __END__ 1: 1 1: 2 1: 3 1: 3 EOString
For character by character processing of a string, substr() and it's buddies are appropriate, not regex. An example showing more of what you are really trying to accomplish would be helpful.