Search Postgresql Archives

Comparing results of regexp_matches

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

 



hi,

I want to check if two similar-looking addresses have the same numbered
street, like 20th versus 21st.

    2033 21st Ave S
    2033 20th Ave S (they're different)

I get an error:

    # select regexp_matches('2033 21st Ave S', '\m(\d+(?:st|th))\M') =
    regexp_matches('2033 20th Ave S', '\m(\d+(?:st|th))\M');
    ERROR:  functions and operators can take at most one set argument

I've tried `()[1] == ()[1]`, etc. but the only thing that works is
making it into 2 subqueries:

    # select (select * from regexp_matches('2033 21st Ave S',
    '\m(\d+(?:st|th))\M')) = (select * from regexp_matches('2033 20th
    Ave S', '\m(\d+(?:st|th))\M'));
     ?column?
    ----------
     f
    (1 row)

Is there a more elegant way to compare the results of
`regexp_matches()`?

Thanks,
Seamus

-- 
Seamus Abshere, SCEA
https://github.com/seamusabshere


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[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