Это должно работать:
String resultString = subjectString.replaceAll("(?s)\\s*#widgetpuffimg\\{.*?\\}\\s*", "");
Объяснение:
"\\s" + // Match a single character that is a “whitespace character” (spaces, tabs, line breaks, etc.)
"*" + // Between zero and unlimited times, as many times as possible, giving back as needed (greedy)
"#widgetpuffimg" + // Match the characters “#widgetpuffimg” literally
"\\{" + // Match the character “{” literally
"." + // Match any single character
"*?" + // Between zero and unlimited times, as few times as possible, expanding as needed (lazy)
"}" + // Match the character “}” literally
"\\s" + // Match a single character that is a “whitespace character” (spaces, tabs, line breaks, etc.)
"*" // Between zero and unlimited times, as many times as possible, giving back as needed (greedy)
В качестве дополнительного бонуса он удаляет пробелы.