alex gorn wrote:so without attaching to the whole task, i'd like to understand why [^\1] doesn't work
Don't know, but if you can't I suspect it has something to do with the level at which you're doing things. '\1' is a bit like a closure, which you're then trying to modify and re-apply to the same
pattern. I've certainly never tried anything like it; and I've been using regexes for 20 years.
I wouldn't stake my life that it
can't be done though.
and how to make that construction usable.
Simple. Find your first pattern, and then create a new one using the result, enclosed as you want: ie, "[^" + result + "]".
But Fred's right. This doesn't sound like a good use of regex to me. If it was me, I'd just trawl through the String and bang each Character I find into a LinkedHashSet. Probably quicker than a regex too.
Winston