I'm creating a new database for a project from an old project which requires a SKU. The SKU is assigned by the govement, however, clients - in order to avoid having to register a new product (it takes months) will take an existing sku - and add various randomness after the sku assigned so for example: ASSIGNED SKU: 12345 CLIENT DEFINED SKU: 12345ABC, or 12345-Oktoberfest, or 12345-123, or 12345.123, or 12345_Oktoberfest-123
there is no way to know what they'll do because the original design of the application was (at best description) remedial...
so I'm pulling in the column marked "sku" and was thinking, huh, ok, so splitting it if I knew the character to split on could be dealt with easily enough for: SKU: 12345 extended_sku: ABC
primarily because I've been reading for a solution on stackoverflow and there are some really good examples.. but for randomness there isn't really an example, and i suck at regex.
So I need to know how to go about testing the string value (it's a varchar field) and then splitting it into SKU bigint peeling off anything not numeric, and inserting that extended_sku into the 2nd table (for normalization) with the parsed off string after the numeric sku...
There is no way to determine the sku length, however, it will always be numeric.
So basically i need to test for anything after the numeric ends
This will be for postgresql 9.5 from a XLSX import which I'm currently pulling into a temp_table to properly format the data (because again, everything is a varchar field - including the pk heh)
Any ideas?
