@oneblink/sdk-core
    Preparing search index...

    Function matchElementsTagRegex

    • Takes a string and calls a provided handler function for each found instance of {ELEMENT:<elementName>} in the string. Used to replace values in OneBlink calculation and info (HTML) elements.

      formElementsService.matchElementsTagRegex(
      myString,
      ({ elementName, elementMatch }) => {
      const v = submission[elementName]
      myString = myString.replace(elementMatch, v)
      },
      )

      Or

      formElementsService.matchElementsTagRegex(
      {
      text: myString,
      excludeNestedElements: true,
      },
      ({ elementName, elementMatch }) => {
      const v = submission[elementName]
      myString = myString.replace(elementMatch, v)
      },
      )

      Parameters

      • options: string | { excludeNestedElements: boolean; text: string }
        • string
        • { excludeNestedElements: boolean; text: string }
          • excludeNestedElements: boolean

            Determine if only root level elements should be matched.

            false will match "{ELEMENT:Parent_Name}" and "{ELEMENT:Children|Name}".

            true will match "{ELEMENT:Parent_Name}" but will NOT replace {ELEMENT:Children|Name}.

          • text: string
      • matchHandler: (options: { elementMatch: string; elementName: string }) => void

      Returns void