I want to convert to Java:
dd fdas dd fdas fads f das fdasf + - || dasfin:"dd" "fdas" "dd" "fdas" "fads" "f" "das" "fdasf" + - || "Dasf"
Basically I want to add quotes around the words. \ w * → "\ w * \"
replaceAll can do this:
replaceAll
String result = input.replaceAll("(\w+)", "\"$1\"");
It is pretty simple. Use preg_replace and orient all captures of text with quotes.
preg_replace("/([a-z0-9]+)/i", '"$1"', $string);
You will need to find the preg_replace replacement for java :)