0
    //Check if the pattern of 9 letters is found
    purposeOfUse = "Auftragsnummer WLLGXRO RH";
    Pattern pattern = Pattern.compile("[a-z]{9,}", Pattern.CASE_INSENSITIVE);

    Matcher matcher = pattern.matcher(purposeOfUse);

I'm trying to find a match for every 9 length string. However, sometimes the string is broken up by a space. How can I in the example of "Auftragsnummer ABCDEFG HI" match with both "Auftragsnummer" AND "ABCDEFGHI"?

I tried to remove all the spaces first, but of course than the match will just be "AuftragsnummerABCDEFGHI"

I don't seem how thiw would work in a while loop because the pattern just finds one.

0 Answers0