From: Nick Dro <postgresql@walla.co.il>
To: pgsqladmin@geoff.dj
To: ken.tanzer@gmail.com
To: pgsql-general@lists.postgresql.org
Cc: ken.tanzer@gmail.com
Cc: <pgsql-general@lists.postgresql.org> <pgsql-general@lists.postgresql.org>
Subject: RE: Re: Re: Allow Reg Expressions in Position function
Date: Mon, 20 Aug 2018 16:46:42 +0300
Message-ID: <^22D695F5F6F276172F0625A5685FD68B121B2ACB@walla.co.il> (raw)
<div><div dir="rtl"><div dir="ltr"><br>Hi,</div>
<div dir="ltr">My specific issue is alrady solved.</div>
<div dir="ltr">For the greater good I sent the email requesting to allow reg exp in the position functions.</div>
<div dir="ltr">Not sure if you will implement it... Just wanted to let you know that the limited capabilities of this function create overhead.</div></div><section class="cust_msg_end"></section><blockquote style="margin:0;margin-bottom:20px;border-top:1px solid #e0e0e0;"><br>ב אוג׳ 20, 2018 14:35, Geoff Winkless כתב:<blockquote style="margin:0;margin-bottom:20px;border-top:1px solid #e0e0e0">
<div dir="ltr"><div style="font-family:verdana,sans-serif;font-size:small"><span style="font-family:Arial,Helvetica,sans-serif">On Mon, 20 Aug 2018 at 09:22, Nick Dro <<a href="mailto:postgresql@walla.co.il">postgresql@walla.co.il</a>> wrote:</span><br></div><div><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div dir="rtl"><div><br>
<div dir="ltr">This incorrect.</div>
<div dir="ltr">SELECT position(substring('<a href="https://www.webexample.com/s/help"; target="_blank">https://www.webexample.com/s/help</a>?'; FROM '/(s|b|t)/') IN '<a href="https://www.webexample.com/s/help?'"; target="_blank">https://www.webexample.com/s/help?'</a>);</div;
<div dir="ltr"> </div>
<div dir="ltr">Gives 5. It's wrong.</div></div></div></div></blockquote><div><br></div><div style="font-family:verdana,sans-serif;font-size:small"></div><br><br><div><div dir="ltr">On Mon, 20 Aug 2018 at 09:22, Nick Dro <<a href="mailto:postgresql@walla.co.il">postgresql@walla.co.il</a>> wrote:<br></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div dir="rtl"><div><br><div dir="ltr">This incorrect.</div><div dir="ltr">SELECT position(substring('<a href="https://www..webexample.com/s/help"; target="_blank">https://www.webexample.com/s/help</a>?'; FROM '/(s|b|t)/') IN '<a href="https://www.webexample.com/s/help?%27"; target="_blank">https://www.webexample.com/s/help?'</a>);</div><div dir="ltr"> </div><div dir="ltr">Gives 5. It's wrong.</div></div></div></div></blockquote><div><br></div><div style="font-family:verdana,sans-serif">For some reason, substring() returns the parenthesised subexpression rather than the top level..</div><div style="font-family:verdana,sans-serif"><br></div><div style="font-family:verdana,sans-serif">The comment in testregexsubstr does say that it does this, but it's not clear from the documentation at all, unless I'm missing where it says it.</div><div style="font-family:verdana,sans-serif"><br></div><div style="font-family:verdana,sans-serif">You can work around this by putting parentheses around the whole expression, because that way the first subexpression is the whole match.</div><div style="font-family:verdana,sans-serif"><br></div><div style="font-family:verdana,sans-serif"><div>db=# SELECT position(substring('<a href="https://www.webexample.com/s/help">https://www.webexample.com/s/help</a>?'; FROM '(/(s|b|t)/)') IN '<a href="https://www.webexample.com/s/help?'">https://www.webexample.com/s/help?'</a>);&...; 27</div><div><br></div></div></div><div style="font-family:verdana,sans-serif;font-size:small">Geoff</div></div></div>
<br></blockquote></blockquote><br></div>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: postgresql@walla.co.il, pgsqladmin@geoff.dj, ken.tanzer@gmail.com
Subject: Re: Allow Reg Expressions in Position function
In-Reply-To: <^22D695F5F6F276172F0625A5685FD68B121B2ACB@walla.co.il>
References: <^22D695F5F6F276172F0625A5685FD68B121B2ACB@walla.co.il>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox