Created
February 26, 2018 04:24
-
-
Save vithalsamp/713fbfb611d566f9e10190291ea446b7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
training=# select regexp_replace(string, '[^[:digit:]]', ' ') from (select ' My zip is 12345 and id is 389362. Send details to my house # 8/22' as string) a; | |
regexp_replace | |
-------------------------------------------------------------------- | |
12345 389362 8 22 | |
(1 row) | |
--Another way to extract the numbers from the string using Redshiftregexp_replace regular expressions | |
training=# select REGEXP_replace(string, '[a-z/-/A-z/./#/*]', '') from (select ' My zip is 12345 and id is 389362. Send details to my house # 8/22' as string) a; | |
regexp_replace | |
------------------------------- | |
12345 389362 822 | |
(1 row) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment