Hi this is part of an example question..I would like to know what exactly this code does.
if (Pattern.compile(".*" + search + ".*", Pattern.CASE_INSENSITIVE).matcher(one).matches());
This is a Regular expression. Basically, the code is the check that content of a search
variable is contained in the text of one
variable.
.*
means 'any character' (.
) 'zero or more times' (*
), So the pattern is search
surrounded by any number of any characters.