i am trying to solve project euler #26 and i am using regex to solve the problem but when compiling i am getting method not found error
import java.lang.*;
import java.math.*;
import java.util.regex.*;
class Pattern {
public static void main(String args[]) {
int count = 0;
String regex = "(//d+?)//1)";
Pattern p = Pattern.compile(regex); //cannot find symbol compile
BigDecimal b = new BigDecimal("1");
for (int i = 1; i <= 10; i++) {
BigDecimal b1 = new BigDecimal(i);
String elem = b.divide(b1, 15, RoundingMode.HALF_UP).toString();
Matcher match = p.matcher(elem); //cannot find symbol matcher
while (match.find()) {
int x = match.start() - match.end();
if (x > count)
count = x;
}
}
System.out.println("the highest count is" + count);
}
}
import java.lang.*;- not neededString regex="(//d+?)//1)";