Jeff actually posted about this in Sanitize HTML. But his example is in C# and I\'m actually more interested in a Java version. Does anyone have a better version for Java? I
The biggest problem by using jeffs code is the @ which currently isnt available.
I would probably just take the "raw" regexp from jeffs code if i needed it and paste it into
http://www.cis.upenn.edu/~matuszek/General/RegexTester/regex-tester.html
and see the things needing escape get escaped and then use it.
Taking the usage of this regex in mind I would personally make sure I understood exactly what I was doing, why and what consequences would be if I didnt succeed, before copy/pasting anything, like the other answers try to help you with.
(Thats propbably pretty sound advice for any copy/paste)