Ad
  • Custom User Avatar

    you are absolutely correct, using a pattern as static variable is about 3-4 times faster.

  • Custom User Avatar

    Correct me if I'm wrong but isn't this solution kind of inneficient in terms of performance in a high concurrency scenario??
    The thing is that everytime you invoke String.matches it has to compile the regex before evaluating the String. If you compile
    the regular expression in advance using an static variable with Pattern.compile() it will perform way better than this solution.
    Isn't it?

    Regards.