I am trying to solve this issue using regex_replace but wondering if there is a smarter to solve it and prevent me from adding more nested regex_replace functions in the future to account for each scenario.
See the following sqlfiddle for the set up. http://sqlfiddle.com/#!17/82948/12
The main issue I am trying to solve for is duplicate values "ACK" or "ZEBRA" or combination of them.
So basically it shouldn't have both ZEBRA and ACK in them. If it does, then take the ACK or ZEBRA closest to the number.
- ACK_ACK_DOV should be ACK_DOV
- ZEBRA_ZEBRA_DOV should be ZEBRA_DOV
- ZEBRA_ACK_ACK_DOV should be ACK_DOV
- ZEBRA_ZEBRA_ACK_DOV should be ACK_DOV
- ZEBRA_393939_DOV should be ZEBRA_393939_DOV
- ZEBRA_ZEBRA_29393930 should be ZEBRA_29393930
| value | fixed | IDEAL |
|---|---|---|
| ACK_ACK_DOV_90000 | ACK_DOV_90000 | ACK_DOV_90000 |
| ACK_910101 | ACK_910101 | ACK_910101 |
| ACK_XIS_900000000 | ACK_XIS_900000000 | ACK_XIS_900000000 |
| GGG_0000000 | GGG_0000000 | GGG_0000000 |
| ASC_VNA_303930 | ASC_VNA_303930 | ASC_VNA_303930 |
| ACK_393848489 | ACK_393848489 | ACK_393848489 |
| ACK_VNA_30303 | ACK_VNA_30303 | ACK_VNA_30303 |
| ACK_XPM_303030303030 | ACK_XPM_303030303030 | ACK_XPM_303030303030 |
| ACK_ACK_DOV_39393 | ACK_DOV_39393 | ACK_DOV_39393 |
| ZEBRA_0393930 | ZEBRA_0393930 | ZEBRA_0393930 |
| ZEBRA_393939_DOV | ZEBRA_393939_DOV | ZEBRA_393939_DOV |
| ZEBRA_VNA_3930321 | ZEBRA_VNA_3930321 | ZEBRA_VNA_3930321 |
| ZEBRA_ACK_ACK_DOV_3934994 | ZEBRA_ACK_DOV_3934994 | ACK_DOV_3934994 |
| ZEBRA_ZEBRA_29393930 | ZEBRA_ZEBRA_29393930 | ZEBRA_29393930 |
Thank you in advance!!
ZEBRA_ACK_ACK_DOV_3934994translate toZEBRA_ACK_VOD_3934994? (a) I thought you only wanted one ofZEBRAorACKin the output, and secondly why isDOVtranslated toVOD?