Regex split numbers and letter groups without spaces

Use the following regex, and get a list of all matches. That will be what you are looking for.

\d+|\D+

In Java, I think the code would look something like this:

Matcher matcher = Pattern.compile("\\d+|\\D+").matcher(theString);
while (matcher.find())
{
    // append matcher.group() to your list
}

Leave a Comment