Extract function and line break

Problem Statement: I am trying to extract a list of string from an html content using the extract function and a combination of striphtml() and substitute(). The list of string contains a couple of line breaks but the extract function is stripping the line breaks. My goal is to keep the line breaks intact. I tried substituting the line breaks with space, it works. But char(13) does not work.

Sample code:

substitute(
  extract(
    striphtml(
      substitute(
        substitute(
          substitute(
            pv!htmlBody,
            "<p class=MsoPlainText>",
            "["
          ),
          "</p>",
          "]"
        ),
        "<br>",
        " "
      )
    ),
    trim(
      "Additional Comments:"
    ),
    trim(
      "Your Workgroup"
    )
  ),
  "][",
  char(
    13
  )
)

  Discussion posts and replies are publicly visible

Parents
  • I figured out the solution. So I substituted the line break with a special character before extracting and then substituted again with char(13) after extracting

    substitute(
    substitute(
      extract(
        striphtml(
          substitute(
            substitute(
              substitute(
                pv!htmlBody,
                "<p class=MsoPlainText>",
                "["
              ),
              "</p>",
              "]"
            ),
            "<br>",
            "##"
          )
        ),
        trim(
          "Additional Comments:"
        ),
        trim(
          "Your Workgroup"
        )
      ),
      "][",
      char(
        13
      )
    ),
    "##",
    char(13)
    )

Reply
  • I figured out the solution. So I substituted the line break with a special character before extracting and then substituted again with char(13) after extracting

    substitute(
    substitute(
      extract(
        striphtml(
          substitute(
            substitute(
              substitute(
                pv!htmlBody,
                "<p class=MsoPlainText>",
                "["
              ),
              "</p>",
              "]"
            ),
            "<br>",
            "##"
          )
        ),
        trim(
          "Additional Comments:"
        ),
        trim(
          "Your Workgroup"
        )
      ),
      "][",
      char(
        13
      )
    ),
    "##",
    char(13)
    )

Children