greedy or not? regexps...
От | Anton Melser |
---|---|
Тема | greedy or not? regexps... |
Дата | |
Msg-id | 92d3a4950702230111v5abcde0fg96117486623306db@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: greedy or not? regexps...
|
Список | pgsql-general |
Hi, I am trying to understand the function substring. Here: select SUBSTRING(cit1.summary, '=([0-9]*)') from cms_items cit1 where cit1.summary ~* '.*linkadministration.*[0-9]*'; gives me two empty strings and select SUBSTRING(cit1.summary, '=([0-9]{1,10})') from cms_items cit1 where cit1.summary ~* '.*linkadministration.*[0-9]*'; gives me the right values. However, bizarrely, select SUBSTRING(ban1.url_id, '=([0-9]*)') from banner ban1 where ban1.url_id ~* '.*linkadministration.*[0-9]*'; select SUBSTRING(ban1.url_id, '=([0-9]{1,10})') from banner ban1 where ban1.url_id ~* '.*linkadministration.*[0-9]*'; Both give me the same result!!! The difference being that in case two the numbers I am catching are at the end of the strings and in case 1 in the middle. Is this normal? Which is correct? Cheers Anton
В списке pgsql-general по дате отправления: