I'd like to extract data from a String, and this String sometimes appears in different ways. For example, it could be any of the following:
Portaria n° 200, 28 de janeiro de 2018.
Portaria n° 200, 28 de janeiro de 2018 da Republica Brasileira.
Portaria n° 200 28 de janeiro de 2018.
Portaria n° 200 2017/2018 de 28 de janeiro de 2018.
There is no pattern. I have tried xsplit: it works in some cases, but it does not work all the time.
    String receberTextoIdentifica = (xmlUtil.xpathElement(documentOrigem, Constantes.GETIDENTIFICACAO).getTextContent());
    LocalDateTime receberDataEnvio = materiaDto.getDataEnvio();
    Integer receberDataEnvioAno = receberDataEnvio.getYear();
    if (receberTextoIdentifica != null && receberTextoIdentifica.toLowerCase().contains("" + receberDataEnvioAno)) {
        Element dataTexto = documentDestino.createElement("dataTexto");
        estruturas.appendChild(dataTexto);
        receberTextoIdentifica = receberTextoIdentifica.substring(0, receberTextoIdentifica.indexOf("" + receberDataEnvioAno) + 4);
        String words[] = receberTextoIdentifica.split(" ");
        String lastFive = words[words.length - 5] + " " + words[words.length - 4] + " " + words[words.length - 3] + " "
                + words[words.length - 2] + " " + words[words.length - 1];
        dataTexto.setTextContent(lastFive);
 
     
    