Java 8 Valide com base em pares de cordas
String input = "one=1&two=2";
Pattern p = Pattern.compile("^(?:\\w*=\\d*(?:&|$))+$");
Matcher m = p.matcher(input);
if (m.matches()) System.out.println("Matches!");
2 Programmers 1 Bug