Search Postgresql Archives

RE: Re: Allow Reg Expressions in Position function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




This incorrect.
SELECT position(substring('https://www.webexample.com/s/help?' FROM '/(s|b|t)/') IN 'https://www.webexample.com/s/help?');
 
Gives 5. It's wrong.
 
The answer to my question is avaliable in Stackoverflow link. but look that it's very complex.
It would be very easy if Reg Exp would be supported.

ב אוג׳ 20, 2018 10:31, Ken Tanzer כתב:
If I correctly understood what you wanted based on the SO description ("Something like: select position ('/s/' or '/b/' or '/t/' in URL)"),

you could do that by combining SUBSTRING with position.  Something like:

SELECT position(substring(URL FROM '/(s|b|t)/') IN URL);

Cheers,

Ken

On Sun, Aug 19, 2018 at 11:27 PM Nick Dro <postgresql@xxxxxxxxxxx> wrote:
Position function allows only string as pattern parameter:
 
select position(sub-string in string)
 
If you are looking for more than one sub-string you can't do it with a single call to position.
More info: 
 
 
Required solution: make sub-string accept regular _expression_ just like the LIKE operator.


--
AGENCY Software  
A Free Software data system
By and for non-profits
(253) 245-3801

learn more about AGENCY or
follow the discussion.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux