static String indent(String item) {

        // '([^']|'')*': Matches the escape sequence "'...'" where the content between "'"
        // characters can contain anything except "'" unless its doubled ('').
        //
        // Then each match is checked. If it starts with "'", it's left unchanged
        // (escaped sequence). Otherwise, it replaces newlines within the match with indent.

        Pattern pattern = Pattern.compile("('([^']|'')*')|\\n");
        Matcher matcher = pattern.matcher(item);
        StringBuffer output = new StringBuffer();

        while (matcher.find()) {
            final String group = matcher.group();
            if (group.startsWith("'")) {
                matcher.appendReplacement(output, Matcher.quoteReplacement(group));
            } else {
                String replaced = group.replaceAll("\n", "\n" + OPERATION_INDENT);
                matcher.appendReplacement(output, Matcher.quoteReplacement(replaced));
            }
        }
        matcher.appendTail(output);

        return "\n" + OPERATION_INDENT + output;
    }
@Test
    void testIndentChildWithEscapedQuotes() {
        String sourceQuery = "SELECT *, '',\n'' FROM source_t";
        String s =
                String.format(
                        "SELECT * FROM (%s\n) WHERE a > 5", OperationUtils.indent(sourceQuery));
        assertThat(s)
                .isEqualTo(
                        "SELECT * FROM (\n"
                                + "    SELECT *, '',\n"
                                + "    '' FROM source_t\n"
                                + ") WHERE a > 5");
    }