<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Do regular expressions support backreferences? in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/do-regular-expressions-support-backreferences/qaa-p/13848616#M4879459</link>
    <description>&lt;P&gt;Particularly funny as I came across that one by chance (?) yesterday, too:)&lt;/P&gt;</description>
    <pubDate>Wed, 19 Sep 2018 10:02:51 GMT</pubDate>
    <dc:creator>VolkerBarth</dc:creator>
    <dc:date>2018-09-19T10:02:51Z</dc:date>
    <item>
      <title>Do regular expressions support backreferences?</title>
      <link>https://community.sap.com/t5/technology-q-a/do-regular-expressions-support-backreferences/qaq-p/13848611</link>
      <description>&lt;P&gt;When using groups within a regex, it is usually possible to &lt;A href="https://www.regular-expressions.info/backref.html" target="_blank"&gt;"back reference"&lt;/A&gt; to such a group via its number (or name), such as "\\1" to reference to the first (capturing) group.&lt;/P&gt;
&lt;P&gt;Am I right that this is not supported with SQL Anywhere?&lt;/P&gt;
&lt;P&gt;Here's a sample:&lt;/P&gt;
&lt;PRE&gt;-- search for a number followed by non-digits and a further number
select regexp_substr('abc-101-abd-102-abe', '(\\\\d+)\\\\D+\\\\d+');
-- -&amp;gt; returns "101-abd-102"

-- If I want the match to restrict to those cases
-- where the first and second number are identical,
-- that requires a backreference via \\1, such as
select regexp_substr('abc-101-abd-102-abe', '(\\\\d+)\\\\D+\\\\1'); -- should not match
select regexp_substr('abc-101-abd-101-abe', '(\\\\d+)\\\\D+\\\\1'); -- should match

However, adding '\\\\1' to the regexp pattern leads to SQLCODE -1135 aka "Invalid regular expression: unsupported syntax in '(\\d+)\\D+\\1'"
&lt;/PRE&gt;

&lt;P&gt;I'm using 16.0.0.2704 but I guess the regex support has been unchanged for quite a number of versions.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 06:56:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/do-regular-expressions-support-backreferences/qaq-p/13848611</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2018-09-18T06:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Do regular expressions support backreferences?</title>
      <link>https://community.sap.com/t5/technology-q-a/do-regular-expressions-support-backreferences/qaa-p/13848613#M4879456</link>
      <description>&lt;P&gt;If backreferences are not supported, that would explain &lt;A href="http://dcx.sap.com/index.html#sqla170/en/html/817336786ce21014814ef87a2e80c6ff.html"&gt;the following doc quote&lt;/A&gt; IMHO:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;(?: pattern ) Non-capturing block&lt;/STRONG&gt;&lt;BR /&gt;
This is functionally equivalent to just pattern, and is provided for compatibility. &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If backreferences are not supported, a group needs no capturing, and so a "capturing group" and a "non-capturing group" would be equivalent...&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 07:34:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/do-regular-expressions-support-backreferences/qaa-p/13848613#M4879456</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2018-09-18T07:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Do regular expressions support backreferences?</title>
      <link>https://community.sap.com/t5/technology-q-a/do-regular-expressions-support-backreferences/qaa-p/13848612#M4879455</link>
      <description>&lt;P&gt;Hi Volker,&lt;/P&gt;
&lt;P&gt;SQL Anywhere does NOT support back references in regular expressions.  &lt;/P&gt;
&lt;P&gt;See &lt;A href="https://help.sap.com/viewer/40c01c3500744c85a02db71276495de5/17.0/en-US/81735cab6ce21014b8a287b4fbb8fdc0.html"&gt;https://help.sap.com/viewer/40c01c3500744c85a02db71276495de5/17.0/en-US/81735cab6ce21014b8a287b4fbb8fdc0.html&lt;/A&gt; for the list of escaped characters supported, and note that back references are not listed.&lt;/P&gt;
&lt;P&gt;Ian&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 09:13:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/do-regular-expressions-support-backreferences/qaa-p/13848612#M4879455</guid>
      <dc:creator>ian_mchardy</dc:creator>
      <dc:date>2018-09-18T09:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: Do regular expressions support backreferences?</title>
      <link>https://community.sap.com/t5/technology-q-a/do-regular-expressions-support-backreferences/qaa-p/13848614#M4879457</link>
      <description>&lt;P&gt;Thanks for the confirmation. I noticed that list but was not sure as the docs also state:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;For REGEXP and REGEXP_SUBSTR, regular expression syntax and support is consistent with Perl 5. &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;which includes backreferences AFAIK.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 09:49:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/do-regular-expressions-support-backreferences/qaa-p/13848614#M4879457</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2018-09-18T09:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: Do regular expressions support backreferences?</title>
      <link>https://community.sap.com/t5/technology-q-a/do-regular-expressions-support-backreferences/qaa-p/13848615#M4879458</link>
      <description>&lt;P&gt;. . . cannot . . . resist . . . must . . . post . . . this &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG width="400" src="https://imgs.xkcd.com/comics/perl_problems.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 09:34:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/do-regular-expressions-support-backreferences/qaa-p/13848615#M4879458</guid>
      <dc:creator>Breck_Carter</dc:creator>
      <dc:date>2018-09-19T09:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: Do regular expressions support backreferences?</title>
      <link>https://community.sap.com/t5/technology-q-a/do-regular-expressions-support-backreferences/qaa-p/13848616#M4879459</link>
      <description>&lt;P&gt;Particularly funny as I came across that one by chance (?) yesterday, too:)&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 10:02:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/do-regular-expressions-support-backreferences/qaa-p/13848616#M4879459</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2018-09-19T10:02:51Z</dc:date>
    </item>
  </channel>
</rss>

