Jump to content

How do I use filters to search a string with Double Quotes?


GradDev
 Share

Recommended Posts

I have a field in Processwire where I save JSON Data.

Something like this:

{"key1":"value1","key2":"value2"}

Now, I want to filter all the pages that have "key1":"value1".

I have tried escaping the double quotes with \ but did not work.

How do I go ahead with this?

Thanks!

Edited by horst
Typo: changed / to \
Link to comment
Share on other sites

4 minutes ago, horst said:

Isn't the escape character this one: \ ?

Right. I used that one but did not work.

I corrected the question.

But now that I dig a little further, it does not seem to be the issue with double quote escaping. It seems to be the issue with the colon (:) character being surrounded by double quotes.
Now, I am trying something like following:

$pages->find("textarea_simple*=:\"value1\"")

And it returns the pages.

But this does not:

$pages->find("textarea_simple*=\":\"value1\"");

Do I need to escape the colon character as well? But simply escaping it with \: does not work.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...