I need to parse through a file(built from a string) searching for occurences of a single or multiline text. Will this solution always work ? If not - how should I change it ?
private int parseString(String s){
Pattern p = Pattern.compile(searchableText);
Matcher m = p.matcher(s);
int count = 0;
while(m.find()) {
count++;
}
return count;
}