| От | Tom Lane |
|---|---|
| Тема | Re: How to retrieve N lines of a text field. |
| Дата | |
| Msg-id | 22882.1075391421@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | How to retrieve N lines of a text field. ("Chris Travers" <chris@travelamericas.com>) |
| Список | pgsql-sql |
"Chris Travers" <chris@travelamericas.com> writes:
> However, this always selects every line but the final one (because %\n seems
> to be interpreted to be the largest possible string, while I want it to be
> the smallest possible string).
I don't think you can solve this in SQL99 regular expressions, but
if you use the POSIX-style regex operators, you can write something
like "[^\n]*\n" to match exactly one line. There are other features
that might help too, such as the counted-match operator "{n}".
Read the man page.
BTW, I bought a copy of the O'Reilly book "Mastering Regular
Expressions" a couple years ago, and it is worth every penny
if you do much of anything with regexes.
regards, tom lane
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера