This is the relevant piece of my code (false is returned if the whole cycle is finished, pattern is a String passed to the function):for (FileLine fileLine : fileLines) {    itemText = fileLine.getText();    itemStrings = new ArrayList<String>();    itemStrings.addAll(Arrays.asList((itemText).split( )));    for (String itemString : itemStrings) {        if (itemString.equalsIgnoreCase(pattern)) {            return true;        }    }}How can I speed this up? I've tried using regex, something like://before the for cyclePattern regexPattern = Pattern.compile(pattern);//in the cycleif (regexPattern.matcher(itemText).matches())    return true;But it doesn't work for some reason. Maybe I'm doing it wrong, or there's a completely different way of accomplishing this?
Matching a pattern in many lines of text
java;performance;regex