I have a table for postal codes, like N9Z3W. I want to copy only the 'N' part to a different column. Basically I need to cut off everything after the first digit
NE9ZW becomes NE
L9C3K3 becomes L
How can I do this using postgres (in a single update query)
Result:
BTW: this does not strictly consumes onto the first digit, but all the leading oppercase characters. For upto something, use a negated (with
^
) pattern, like this: