This Regular expression will remove all special character from String except underscore(_) and numbers and this formatted String can be used in creating table in database where special characters are not allowed and other places as well as per need.
String rawInput = " Company (Details_) India?]$$$";
String regEx = "[^A-Za-z0-9_]+";
String expctedOutput = rawInput.replaceAll(regEx, "");
System.out.println(expctedOutput);
Output = CompanyDetails_India
String rawInput = " Company (Details_) India?]$$$";
String regEx = "[^A-Za-z0-9_]+";
String expctedOutput = rawInput.replaceAll(regEx, "");
System.out.println(expctedOutput);
Output = CompanyDetails_India