Regex: Matcher findet kein Match

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Regex: Matcher findet kein Match

by Anonymous » 21 Aug 2025, 07:37

Ich habe den folgenden Code < /p>

Code: Select all

    String expression="a weird case of {asda}something";
Pattern aPattern=Pattern.compile("\\{(.*?)\\}");
Matcher matcher = aPattern.matcher(expression);
boolean match = matcher.matches();
< /code>

Dies wirft immer < /up>

ausException in thread "main" java.lang.IllegalStateException: No match found
< /code>

Ich verstehe nicht, warum es keine Übereinstimmung findet. Die Ausgabe sollte {seinasda}
. Irgendwelche Ideen?

Top