in reply to Re: Regex: matching character which happens exactly once
in thread Regex: matching character which happens exactly once

Duh, it's actually much simpler, and this one even captures the single character(s)! (Update 2: See Variable-Width Lookbehind (hacked via recursion))

/(.)(?!((?<=(?!\1).(?=(?2)).|(?=\1)..))|.*\1)/s