ok straight to the problem, i have this String that my program reads from a file:
im trying to use a regular expressionpackage javaapplication1; public class Main { public static void main(String[] args) { String example = "0001Brad Lambert 00000200.0008081987blambert@my.wctc.edu"; int tmpa,tmpb; String tmp; String nameexp = "[A-Z][a-zA-Z]{3,} [A-Z][a-zA-Z]{3,}"; tmpa = example.indexOf(nameexp); tmpb = example.lastIndexOf(nameexp); System.out.println(tmpa); System.out.println(tmpb); tmp = example.substring(tmpa, tmpb); System.out.println(tmp); } }
to pulll out the name "Brad Lambert" to a temporary string value
problem is tmpa and tmpb keep returning a value of -1.