39

I want to search for a list of name through records of another table i want that my regex be case insensitive, but I can not make it work!

SELECT id
  FROM "regexfreeFlickrFullInfo"
  where tags ~ 'tower\s?\*?bridge'  or title ~ 'tower\s?\*?bridge' or descriptio ~ 'tower\s?\*?bridge'  order by id asc;

here is my query, I have tested by i, but it did not work!

2 Answers 2

74

You must use ~* instead of ~.

Sign up to request clarification or add additional context in comments.

Comments

16

If you want to support case sensitive and insensitive queries without changing the query itself, you may change the behavior of the operator with the Regular Expression Metasyntax. They can override the case-sensitivity behavior implied by a regex operator..

tags ~ 'Case Sensitive'
tags ~ '(?i)case insensitive'
tags ~* 'case insensitive'
tags ~* '(?c)Case Sensitive'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.