Java - Write code to split Camel Case String with Regex

Requirements

Write code to split Camel Case String with Regex

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String text = "AbcDefXyz";
        System.out.println(splitCamelCase(text));
    }/*from   w  w w .j ava 2s  . c o  m*/

    public static String splitCamelCase(String text) {
        return text.replaceAll("(?=[A-Z]+)", " ").trim();
    }
}