-2

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());
Me..
  • 19
  • 5

1 Answers1

0

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.

Grief
  • 1,839
  • 1
  • 21
  • 40