why non-greedy modifier for one atom changes greediness of other atoms?
В списке pgsql-general по дате отправления:
| От | hubert depesz lubaczewski |
|---|---|
| Тема | why non-greedy modifier for one atom changes greediness of other atoms? |
| Дата | |
| Msg-id | 20100104103051.GA21234@depesz.com обсуждение |
| Ответы |
Re: why non-greedy modifier for one atom changes
greediness of other atoms?
|
| Список | pgsql-general |
Example:
# select x, substring( x from E'^((.*?)(\\.[0-9]+))') from ( values ('ab.123xxx.46hfd'),('a.b.c.d.123xx')) as q (x);
x | substring
-----------------+-----------
ab.123xxx.46hfd | ab.1
a.b.c.d.123xx | a.b.c.d.1
(2 rows)
I found in docs, that this is what happens, but I don't understand the
logic behind forcing unique greediness in whole expression.
Also - how can one write a regexp that will match "ab.123" and
"a.b.c.d.123" respectively?
in pl/perl it's of course trivial, but I can't seem to find a way to do it in substring() regexps.
Best regards,
depesz
--
Linkedin: http://www.linkedin.com/in/depesz / blog: http://www.depesz.com/
jid/gtalk: depesz@depesz.com / aim:depeszhdl / skype:depesz_hdl / gg:6749007
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера