Here is my try:
Java:
public static void main(String[] args) {
String text = "This && is **^^ a ~~@@ test.";
System.out.println(Pattern.compile("\\p{Punct}").matcher(text).replaceAll(""));
// OUT: This is a test --> As I expected
}
C#:
static void Main(string[] args) {
string text = "This && is **^^ a ~~@@ test.";
Console.WriteLine(Regex.Replace(text, "\\p{P}", ""));
// OUT: This is ^^ a ~~ test
// expected: This is a test
Console.ReadLine();
}
Any ideas? Thank you!