About 8,960,000 results
Open links in new tab
  1. java - pattern.matcher () vs pattern.matches () - Stack Overflow

    Oct 5, 2010 · Matcher.find() attempts to find the next subsequence of the input sequence that matches the pattern. Pattern.matches(String regex, CharSequence input) compiles the regex into a Matcher …

  2. What's the difference between String.matches and Matcher.matches?

    Mar 18, 2010 · A Matcher is created on on a precompiled regexp, while String.matches must recompile the regexp every time it executes, so it becomes more wasteful the more often you run that line of code.

  3. java - How to use Pattern and Matcher? - Stack Overflow

    Apr 15, 2018 · How to use Pattern and Matcher? [duplicate] Asked 7 years, 8 months ago Modified 7 years, 8 months ago Viewed 2k times

  4. java - What does Matcher.find () really do? - Stack Overflow

    Jul 3, 2023 · Pattern.compile("[abc]+").matcher("ababab").find() --> group = "ababab" which skips over the fact that a is a perfectly fine match for the pattern. I think what's happening is that, given that the …

  5. java - How do Mockito matchers work? - Stack Overflow

    Mockito argument matchers (such as any, argThat, eq, same, and ArgumentCaptor.capture()) behave very differently from Hamcrest matchers. Mockito matchers frequently cause …

  6. java - Matchers.any () for null value in Mockito - Stack Overflow

    Sep 29, 2015 · Therefore, the fix is to use a matcher for the second parameter of the method as well. In this case, it would be a matcher matching null. Depending on the version of Mockito and Java, you …

  7. Java -- Patterns -- Matcher.group ()? - Stack Overflow

    Sep 15, 2012 · Here, however, you are printing matcher.group only once per match.find invoke. This means you only print each matched subsequence once, rather than lengthOfTargetNTuple times.

  8. How can I count the number of matches for a regex?

    Counting number of matches that occur within the string. The java.util.regex.Matcher.region (int start, int end) method sets the limits of this matcher's region. The region is the part of the input sequence that …

  9. Difference between matches () and find () in Java Regex

    A matcher is created from a pattern by invoking the pattern's matcher method. Once created, a matcher can be used to perform three different kinds of match operations: The matches method attempts to …

  10. java - String replaceAll () vs. Matcher replaceAll () (Performance ...

    Jan 19, 2022 · Pattern.compile(regex).matcher(str).replaceAll(repl) Therefore, it can be expected the performance between invoking the String.replaceAll, and explicitly creating a Matcher and Pattern …