why can i not do pattern.test(string) ?