0

Is there a way for me to search using wild-card % in Postgres to only retain the searches that have non-zero replacement of %? So %a% should only result in cab but not a. If not with %, is there another simple way to do so? Thanks!

1
  • 1
    Use _ instead of %. Commented Jun 22, 2017 at 20:47

1 Answer 1

2

From the manual

An underscore (_) in pattern stands for (matches) any single character; a percent sign (%) matches any sequence of zero or more characters.

You need to use _ instead of %

Edited
Final expression as suggested by @Abelisto should be '%_a_%'

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

1 Comment

I think "non-zero" (one or more) means %_a_%

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.