Using regex in WHERE in Postgres

Using regex in WHERE in Postgres

Asked on January 10, 2019 in PostgreSQL.
Add Comment


  • 2 Answer(s)

    Write rather:

    select * from table where name ~ 'foo'
    
    

    The ‘~’ process produces a boolean result for whether the regex matches or not rather than extracting the matching subgroups.

    Answered on January 10, 2019.
    Add Comment

    Simply use match operator :

    select * from table where name ~ 'foo';
    
    
    Answered on January 10, 2019.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.