public static boolean isEcCoordBase64Valid(String s) {
        return s.matches("(?:[A-Za-z0-9-_]{4})*(?:[A-Za-z0-9-_]{2}|[A-Za-z0-9-_]{3})");
    }
@Test
    public void testIsEcCoordBase64Valid() {
        BigInteger example =
                new BigInteger(
                        "3229926951468396372745881109827389213802338353528900010374647556550771243437");
        String message = Base64.getEncoder().encodeToString(example.toByteArray());

        // Format to standard
        message =
                message.replaceAll("[+]", "-")
                        .replaceAll("[/]", "_")
                        .substring(0, message.length() - 1);

        assertTrue(isEcCoordBase64Valid(message));
        assertFalse(isEcCoordBase64Valid(example.toString()));
    }