L
laredotornado
Hi,
I was hoping someone could help me with a simple regular expression
dilemma. I'm using Java 1.5. I have this code:
String regex = accountid; // value is
9998698989898
System.out.println("regexp:" + regex);
Pattern p1 = Pattern.compile(regex);
Matcher m1 = p1.matcher(pageString);
System.out.println("m1 group count:" + m1.groupCount());
System.out.println(pageString.indexOf(regex));
assertTrue(m1.matches());
The assertion ("m1.matches") fails, even though "pageString.indexOf"
returns a value greater than -1, indicating the string is found. So
I'm missing something fundamental about regular expressions.
Any help is appreciated, - Dave
I was hoping someone could help me with a simple regular expression
dilemma. I'm using Java 1.5. I have this code:
String regex = accountid; // value is
9998698989898
System.out.println("regexp:" + regex);
Pattern p1 = Pattern.compile(regex);
Matcher m1 = p1.matcher(pageString);
System.out.println("m1 group count:" + m1.groupCount());
System.out.println(pageString.indexOf(regex));
assertTrue(m1.matches());
The assertion ("m1.matches") fails, even though "pageString.indexOf"
returns a value greater than -1, indicating the string is found. So
I'm missing something fundamental about regular expressions.
Any help is appreciated, - Dave