Skip to main content
rishukumarg1965
June 10, 2024
Solved

Extract the value of PM and CM from the given text.

  • June 10, 2024
  • 6 replies
  • 0 views

text - "CM: Nick Hunt ECE: Fred Wang General Contractor: Villamar PM: Rick Chan RF Designer: Eric Chan ",

output-

CM: Nick Hunt 

PM: Rick Chan RF

    Best answer by yogip3177

    Stefan already asked you to provide the required details (order, pattern, etc.) for an error-free solution. However, you can try the following code:

    a!localVariables(
      local!text: "CM: Nick Hunt ECE: Fred Wang General Contractor: Villamar PM: Rick Chan RF Designer: Eric Chan ",
      local!dText: substitute(
        substitute(
          substitute(
            substitute(local!text, "ECE:", ";ECE:"),
            "General Contractor:",
            ";General Contractor:"
          ),
          "PM:",
          ";PM:"
        ),
        "RF Designer:",
        ";RF Designer:"
      ),
      local!data: split(local!dText, ";"),
      local!data
    )

    Output:

    List of Text String - 5 items

      • "CM: Nick Hunt "(Text)
          • "ECE: Fred Wang "(Text)
              • "General Contractor: Villamar "(Text)
                  • "PM: Rick Chan "(Text)
                      • "RF Designer: Eric Chan "(Text)

                      6 replies

                      stefanhelzle0001
                      Brainy
                      June 10, 2024

                      Is that a coding challenge?

                      rishukumarg1965
                      June 10, 2024

                      no

                      stefanhelzle0001
                      Brainy
                      June 10, 2024

                      OK. Do you have any specific questions or code you would want to share?

                      yogip3177Answer
                      June 11, 2024

                      Stefan already asked you to provide the required details (order, pattern, etc.) for an error-free solution. However, you can try the following code:

                      a!localVariables(
                        local!text: "CM: Nick Hunt ECE: Fred Wang General Contractor: Villamar PM: Rick Chan RF Designer: Eric Chan ",
                        local!dText: substitute(
                          substitute(
                            substitute(
                              substitute(local!text, "ECE:", ";ECE:"),
                              "General Contractor:",
                              ";General Contractor:"
                            ),
                            "PM:",
                            ";PM:"
                          ),
                          "RF Designer:",
                          ";RF Designer:"
                        ),
                        local!data: split(local!dText, ";"),
                        local!data
                      )

                      Output:

                      List of Text String - 5 items

                        • "CM: Nick Hunt "(Text)
                            • "ECE: Fred Wang "(Text)
                                • "General Contractor: Villamar "(Text)
                                    • "PM: Rick Chan "(Text)
                                        • "RF Designer: Eric Chan "(Text)