What method should I follow in java to produce
\"WordWord\"
from
\"Word#$#$% Word 1234\"
public static void main(String[] args) { String input = "Word#$#$% Word 1234"; String extract = input.replaceAll("[^a-zA-Z]+", ""); System.out.println(extract); }
output:
WordWord