regex modification template

This commit is contained in:
Paul Trowbridge 2017-10-19 17:39:29 -04:00
parent 2979fd3437
commit 75d511f6a4

View File

@ -1,40 +1,166 @@
SELECT
jsonb_pretty(
$$
{
"defn": [
{
"key": "{Description}",
"field": "ini",
"regex": "([\\w].*?)(?=$| -|\\s[0-9].*?|\\s[\\w/]+?:)"
},
{
"key": "{Description}",
"field": "compn",
"regex": "Comp Name:(.+?)(?=$| Comp|\\w+?:)"
},
{
"key": "{Description}",
"field": "adp_comp",
"regex": "Cust ID:.*?(B3X|UDV|U7E|U7C|U7H|U7J).*?(?=$|\\w+?:)"
},
{
"key": "{Description}",
"field": "desc",
"regex": "Desc:(.+?) Comp"
},
{
"key": "{Description}",
"field": "discr",
"regex": "Discr:(.+?)(?=$| SEC:|\\w+?:)"
}
],
"type": "extract",
"where": [
{
"Transaction": "ACH Debits"
}
]
}
$$::jsonb
)
INSERT INTO
tps.map_rm
SELECT *
FROM
(VALUES
('PNCC', 'ACH Debits',
$j$
{
"defn": [
{
"key": "{Description}",
"field": "ini",
"regex": "([\\w].*?)(?=$| -|\\s[0-9].*?|\\s[\\w/]+?:)"
,"retain":"y"
},
{
"key": "{Description}",
"field": "compn",
"regex": "Comp Name:(.+?)(?=$| Comp|\\w+?:)"
,"retain":"y"
},
{
"key": "{Description}",
"field": "adp_comp",
"regex": "Cust ID:.*?(B3X|UDV|U7E|U7C|U7H|U7J).*?(?=$|\\w+?:)"
,"retain":"y"
},
{
"key": "{Description}",
"field": "desc",
"regex": "Desc:(.+?) Comp"
,"retain":"y"
},
{
"key": "{Description}",
"field": "discr",
"regex": "Discr:(.+?)(?=$| SEC:|\\w+?:)"
,"retain":"y"
}
],
"where": [
{
"Transaction": "ACH Debits"
}
]
}
$j$::jsonb
, 2)
,('PNCC', 'Trans Type',
$j$
{
"defn": [
{
"key": "{AccountName}",
"field": "acctn",
"regex": "(.*)"
,"retain":"n"
},
{
"key": "{Transaction}",
"field": "trans",
"regex": "(.*)"
,"retain":"n"
},
{
"key": "{Description}",
"field": "ini",
"regex": "([\\w].*?)(?=$| -|\\s[0-9].*?|\\s[\\w/]+?:)"
,"retain":"y"
}
],
"where": [
{
}
]
}
$j$::jsonb
, 1)
,('PNCC', 'Wires Out',
$j$
{
"defn": [
{
"key": "{Description}",
"field": "ini",
"regex": "([\\w].*?)(?=$| -|\\s[0-9].*?|\\s[\\w/]+?:)"
,"retain":"y"
},
{
"key": "{Description}",
"field": "bene",
"regex": "BENEFICIARY:(.+?) AC/"
,"retain":"y"
},
{
"key": "{Description}",
"field": "accts",
"regex": "AC/(\\w*) .*AC/(\\w*) "
,"retain":"y"
}
],
"where": [
{
"Transaction": "Intl Money Transfer Debits"
},
{
"Transaction": "Money Transfer DB - Wire"
}
]
}
$j$::jsonb
, 2)
,('PNCC', 'Currency',
$j$
{
"defn": [
{
"key": "{Description}",
"field": "ini",
"regex": "([\\w].*?)(?=$| -|\\s[0-9].*?|\\s[\\w/]+?:)"
,"retain":"y"
},
{
"key": "{Description}",
"field": "curr1",
"regex": ".*(DEBIT|CREDIT).*(USD|CAD).*(?=DEBIT|CREDIT).*(?=USD|CAD).*"
,"retain":"y"
},
{
"key": "{Description}",
"field": "curr2",
"regex": ".*(?=DEBIT|CREDIT).*(?=USD|CAD).*(DEBIT|CREDIT).*(USD|CAD).*"
,"retain":"y"
}
],
"where": [
{
"Transaction": "Miscellaneous Credits"
},
{
"Transaction": "Miscellaneous Debits"
}
]
}
$j$::jsonb
, 2)
,('PNCC', 'Check Number',
$j$
{
"defn": [
{
"key": "{Description}",
"field": "checkn",
"regex": "[^0-9]*([0-9]*)\\s|$"
,"retain":"y"
}
],
"where": [
{
"Transaction": "Checks Paid"
}
]
}
$j$::jsonb
, 2)
) x