function processRegex({ segment, transaction, regex, value }) {
  const re = new RegExp(regex.statement, regex.flags)
  let regexMatches
  if (regex?.flags?.includes('g') === true) {
    regexMatches = Array.from(value.matchAll(re))
  } else {
    const regexMatch = value.match(re)
    regexMatches = regexMatch ? [regexMatch] : []
  }

  if (regexMatches.length) {
    for (const regexMatch of regexMatches) {
      processRegexGroups({ segment, groups: regex.groups, regexMatch, transaction })

      if (regex?.name && regex?.value && regex.prefix) {
        assignToTarget({
          segment,
          target: regex.target,
          transaction,
          name: `${regex.prefix}${regexMatch[regex.name]}`,
          value: regexMatch[regex.value]
        })
      }
    }
  }
}
Processes a regex match and adds attributes to the segment based on the regex groups.
@param {object} params - The parameters for the regex processing.
@param {object} params.segment - The segment to add attributes to.
@param {object} params.transaction - The transaction object.
@param {object} params.regex - The regex to use for matching.
@param {string} params.value - The value to match against the regex.