Java tutorial
public class Main { public static void main(String[] args) { String input = "4 5 \\asd"; input = input.replaceAll("\\\\[a-zA-Z0-9]*", ""); System.out.println(input); } }