From: | Jan-Erik <jan-erik(dot)larka(at)os2world(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | split string by special characters |
Date: | 2009-07-23 12:21:13 |
Message-ID: | 55ea945f-f135-451e-8c3b-23d177aa4692@g31g2000yqc.googlegroups.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I wonder if you could please help me out to extract a character string
to an array or better yet, a table.
I'd like to split strings of text up into words and delimiters (but
not delete the delimiters). The delimiters are defined as comma,
space, dot, singe/double quotation mark, question mark etc.¹ in a
separate table (delimiters) depending on what rules apply for the
input.
regexp_split_to_array/table seem quite suitable but I have
difficulties to form the right expression with it, apart from that it
remove the delimiters as well.
Example:
This is just a text that contain special characters such as , (comma),
"(", ")" (left and right parenthesis) as well as "?" question mark.
How do I split it up with PostgreSQL?
Expected result:
{This, " ", is, " ", just, " ", a, ..., PostgreSQL, "?" }
__________________
¹) Also later on tags such as <html> and at other times something
else depending on the circumstances.
//Jan-Erik
From | Date | Subject | |
---|---|---|---|
Next Message | Andreas Wenk | 2009-07-23 12:24:35 | Re: comparing NEW and OLD (any good this way?) |
Previous Message | Thomas Kellerer | 2009-07-23 12:12:58 | Re: comparing NEW and OLD (any good this way?) |