'How can I parse out of the last instance of text after a delimiter (big query)

Ex of value: [{‘test’:’https://‘,’id’,’2521’,’Shipment’}]

I would only want to return Shipment as the value returned for that field



Solution 1:[1]

Solution:

SPLIT(components, "'")[SAFE_OFFSET(ARRAY_LENGTH(SPLIT(components, "'")) - 2)]

Solution 2:[2]

Use below instead

array_reverse(split(translate(components, '[]{}', '')))[offset(0)]

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Brent Worden
Solution 2 Mikhail Berlyant