I am generating a Word doc in xml based on customer input, and of course it blows up whenever an &
is used. I tried replacing all instances of &
with &
, but then &
literally shows up in my Word Doc. Here's my code:
static String replace(String in) {
String ampersand = "&(?![a-zA-Z][a-zA-Z][a-zA-Z]?[a-zA-Z]?;)";
return in.replaceAll(ampersand,"&");
}
Any ideas?