I’m working on a query where I need to parse Description field that follow the pattern “userid-date-amount-” For example, a valid value would be: 222826-2022/07/26-32,700,000-
However, my current implementation also extracts values like the following:
Tracking code: 1160685022- Date: 2022/07/26- Time: 21:02- Last 4 digits: None- First 4 digits: None- Amount: 350 thousand Dollars- To Paypal
I want to modify my parsing logic to only consider values that strictly adhere to the “userid-date-amount-” format.
SELECT
i."Id",
i."Description",
unnest(regexp_matches(i."Description", '(d+)-(.*?)-(.*)-')) AS extracted_data
FROM "public"."Invoices" i