You can translate the question and the replies:

Remove duplicate words with a regular expressión

Hello: I have this input: abc,abc,123,000,123,000 And I need to remove duplicates words. The output must be: abc,123,000 I'm using this regexp: \\b(\\w+)\\b\\s*,\\s*(?=.*\\1) but it doesn't work. I'm testing in this page were works: https://regex101.com/r/sS2dM8/24 I'm using select regexp('abc,abc,123,000,123,000','\\b(\\w+)\\b\\s*,\\s*(?=.*\\1)','') from dual(); but the output is abc,abc,123,000,123,000 can you help?
user
04-12-2020 04:17:09 -0500

1 Answer

Hi, I was able to get unique value without any duplicates using regular expression as "(?<=\,|^)(.+?)\,(?=(.+\,)?\1(\,|$))". For Example: `select regexp('abc,abc,123,000,123,000','(?<=\,|^)(.+?)\,(?=(.+\,)?\1(\,|$))','') from dual()` For more details, you can refer to [REGEXP](https://community.denodo.com/docs/html/browse/7.0/vdp/vql/appendix/syntax_of_condition_functions/text_processing_functions#regexp) section of the Virtual DataPort VQL Guide. Hope this helps!
Denodo Team
07-12-2020 07:38:34 -0500
You must sign in to add an answer. If you do not have an account, you can register here