About 54 results
Open links in new tab
  1. 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 …

  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 - pattern.matcher () vs pattern.matches () - Stack Overflow

    Oct 5, 2010 · 4 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 …

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

  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. What's the difference between Matcher.lookingAt() and find()?

    May 2, 2015 · The documentation for Matcher.lookingAt clearly explains the region lookingAt tries to match: Like the matches method, this method always starts at the beginning of the region; unlike that …

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

  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 - How Matcher.find () works - Stack Overflow

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

  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 …