in reply to Regex: matching character which happens exactly once
Also, it seems you want a forward reference, in the same spirit as a backref -- something the regex engine will go check after "filling" the ref:
my ($match) = /^(?:[^\1]*)(.)(?:[^\1]*)$/;
Here rendered as \1, just like the backref.
As the first capturing paren hasn't been encountered before the backref mention triggers different behavior in the regex path. This will make backtracking more painful, and possibly more likely to be pathological, but one has to assume some risk...
-QM
--
Quantum Mechanics: The dreams stuff is made of
In Section
Seekers of Perl Wisdom