split string by special characters

Поиск
Список
Период
Сортировка
От Jan-Erik
Тема split string by special characters
Дата
Msg-id 55ea945f-f135-451e-8c3b-23d177aa4692@g31g2000yqc.googlegroups.com
обсуждение исходный текст
Ответы Re: split string by special characters
Список 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

В списке pgsql-general по дате отправления:

Предыдущее
От: Matthew Seaborn
Дата:
Сообщение: Search Path vs Synonyms
Следующее
От: Matt Harrison
Дата:
Сообщение: Re: enabling join_collapse_limit for a single query only