in reply to perl indication of end of string already matched

I believe you can envelope a piece of regex of interest inside parentheses, e.g. "m/.|($ )/gcx", and ask if $1 is defined.
Also I believe this can help: m/.|$ (?{ $matched = 1; })/gcx