RE: Re: Allow Reg Expressions in Position function

From: Nick Dro <postgresql(at)walla(dot)co(dot)il>
To: ken(dot)tanzer(at)gmail(dot)com, pgsql-general(at)lists(dot)postgresql(dot)org
Cc: pgsql-generallists(dot)postgresql(dot)org <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: RE: Re: Allow Reg Expressions in Position function
Date: 2018-08-20 08:22:00
Message-ID: ^CEC1B8B2E2F78C3BF5874A03551BA9485B070EC7@walla.co.il
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<div><div dir="rtl"><div><br>
<div dir="ltr">This incorrect.</div>
<div dir="ltr">SELECT position(substring('https://www.webexample.com/s/help?' FROM '/(s|b|t)/') IN 'https://www.webexample.com/s/help?');</div>
<div dir="ltr">&nbsp;</div>
<div dir="ltr">Gives 5. It's wrong.</div>
<div dir="ltr">&nbsp;</div>
<div dir="ltr">The answer to my question is avaliable in Stackoverflow link. but look that it's very complex.</div>
<div dir="ltr">It would be very easy if Reg Exp would be supported.</div>
</div></div><section class="cust_msg_end"></section><blockquote style="margin:0;margin-bottom:20px;border-top:1px solid #e0e0e0;"><br>ב אוג׳ 20, 2018 10:31, Ken Tanzer כתב:<blockquote style="margin:0;margin-bottom:20px;border-top:1px solid #e0e0e0">
<div dir="ltr">If I correctly understood what you wanted based on the SO description ("Something like: select position ('/s/' or '/b/' or '/t/' in URL)"),<div><br></div><div>you could do that by combining SUBSTRING with position.&nbsp; Something like:</div><div><br></div><div><pre id="gmail-hterm:copy-to-clipboard-source" style="color:rgb(0,0,0)">SELECT position(substring(URL FROM '/(s|b|t)/') IN URL);</pre><br>Cheers,<br><br>Ken</div></div><br><div><div dir="ltr">On Sun, Aug 19, 2018 at 11:27 PM Nick Dro &lt;<a href="mailto:postgresql(at)walla(dot)co(dot)il">postgresql(at)walla(dot)co(dot)il</a>&gt; wrote:<br></div><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="rtl"><div dir="ltr">Position function allows only string as pattern parameter:</div>

<div dir="ltr">&nbsp;</div>
<div dir="ltr">select position(sub-string in string)</div>
<div dir="ltr">&nbsp;</div>
<div dir="ltr">If you are looking for more than one sub-string you can't do it with a single call to position.</div>
<div dir="ltr">More info:&nbsp;</div>
<div dir="ltr"><a href="https://stackoverflow.com/questions/51925037/how-to-find-position-of-multiple-sub-string-in-postgresql" target="_blank">https://stackoverflow.com/questions/51925037/how-to-find-position-of-multiple-sub-string-in-postgresql</a></div>
<div dir="ltr">&nbsp;</div>
<div dir="ltr">&nbsp;</div>
<div dir="ltr">Required solution: make&nbsp;sub-string accept regular expression just like the LIKE operator.</div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><img src="https://api-mail.walla.co.il/proxy?url=http%3A%2F%2Fagency-software.org%2Fdemo%2Fclient%2Fimages%2Fagency_logo_small.png&amp;scr=7c5175f9da65695c67c47a1de9520c8f"><div><font size="4">AGENCY Software &nbsp;</font><br><div>A Free Software data system</div><div>By and for non-profits</div><div><i><a href="http://agency-software.org/" target="_blank">http://agency-software.org/</a></i></div><div><i><a href="https://demo.agency-software.org/client" target="_blank">https://demo.agency-software.org/client</a></i><br></div><div><a href="mailto:ken(dot)tanzer(at)agency-software(dot)org" target="_blank">ken(dot)tanzer(at)agency-software(dot)org</a></div><div>(253) 245-3801</div><div><br></div></div><div><a href="mailto:agency-general-request(at)lists(dot)sourceforge(dot)net?body=subscribe" target="_blank">Subscribe to the mailing list</a>&nbsp;to</div><div>learn more about AGENCY or</div><div>follow the discussion.</div></div></div></div></div>

<br></blockquote></blockquote><br></div>

Attachment Content-Type Size
unknown_filename text/html 3.3 KB

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Geoff Winkless 2018-08-20 11:35:23 Re: Re: Allow Reg Expressions in Position function
Previous Message Ken Tanzer 2018-08-20 07:31:24 Re: Allow Reg Expressions in Position function