// Small program to test a regular expression against a string // pass the regular expression and the string in as command line arguments // // Example: // java Validate "( *[0-9]+)+" "123 456 789" public class Validate { public static void main(String[] args) { System.out.println("Reg expression = " + args[0]); System.out.println("String = " + args[1]); if (args[1].matches(args[0])) System.out.println("Yes, it is a match"); else System.out.println("No, not a match"); } }