Skip to content

regexp_match( ) do not work on PostgreSQL 11 for these cases #10

Closed

Description

@jhl8917

SELECT crime_id,
regexp_match(original_text, '(?:Sq.|Plz.|Dr.|Ter.|Rd.)\n(\w+ \w+|\w+)\n')
AS city
FROM crime_reports;

SELECT crime_id,
regexp_match(original_text, 'hrs.\n(\d+ .+(?:Sq.|Plz.|Dr.|Ter.|Rd.))') AS street
FROM crime_reports;

SELECT crime_id,
regexp_match(original_text, '\n(?:\w+ \w+|\w+)\n(.*):') AS crime_type
FROM crime_reports;

Activity

  1. anthonydb commented on Nov 3, 2018

    @anthonydb
    Owner

    Hi, thanks for reaching out. I just tried these on PostgreSQL 11 on macOS (Postgres.app and pgAdmin 3.5). They worked fine. Haven't tested on Windows or Linux yet.

    Which operating system are you using?

    Also, did you by any chance open crime_reports.csv in Excel or another text editor before importing? Sometimes, doing so might change the file encoding.

  2. jhl8917 commented on Nov 4, 2018

    @jhl8917
    Author

    Dear Mr. DeBararros,

    Thank you for your quick reply. I ran the codes on Windows and pgAdmin 4. I will try to run again with untouched crime_reports.csv. Thanks again,

    Johnathan Liu

  3. jhl8917 commented on Nov 4, 2018

    @jhl8917
    Author

    Dear Mr. DeBararros,

    After I copy new crime_reports.csv to my working directory, these codes work now.
    Thank you for your excellent book.

    Best,
    Johnathan Liu

  4. anthonydb commented on Nov 6, 2018

    @anthonydb
    Owner

    Glad to hear that all worked out. Thank you for reading!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions