About 51 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. java - How to use Pattern and Matcher? - Stack Overflow

    Apr 15, 2018 · 0 I wouldn't even use a formal matcher for these simple use cases. Java's String#matches() method can just as easily handle this. To check for a valid name using your rules, …

  3. 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 …

  4. 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 …

  5. Comparar varios patrones con Pattern y Matcher en java

    Feb 17, 2018 · Tengo que leer de un fichero te texto datos línea por línea y, según lo que haya en la línea, aplicarle un patrón distinto para reconocer la información. Este es una parte del fichero: [018 …

  6. 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.

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

    The Mockito matcher intThat wraps that Hamcrest-style Matcher and returns an int so it can appear as an argument; Mockito matchers like gt(9000) would wrap that entire expression into a single call, as …

  8. 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.

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

    Jan 19, 2022 · Are there known difference(s) between String.replaceAll() and Matcher.replaceAll() (On a Matcher Object created from a Regex.Pattern) in terms of performance? Also, what are the high …

  10. java - How Matcher.find () works - Stack Overflow

    How Matcher.find () works [duplicate] Asked 13 years, 7 months ago Modified 2 years, 5 months ago Viewed 58k times