Realm RN - CONTAINS query with constant on left side

I’m working on a React Native app, using Realm. I need to find all the items in a table, where a certain “name” property contains a constant string, or the other way around. Normally, I would do something like this:

instance.objects(model).filtered(“name CONTAINS[c] ‘myString’”);

However, I need to return the results where contains ‘myString’ OR ‘myString’ contains I tried “‘myString’ CONTAINS[c] name” but it doesn’t work. Is there a way to accomplish what I need to do using only Realm queries?

Not sure I fully follow - let me (attempt to) re-state the question

Suppose = "My Name Is Jay"

And you are seaching for

searchString = "Jay"

so you want to return results where the string contains “Jay”

so far, so good. But then you want to return results where “Jay” contains “My Name Is Jay” ???

Can you clarify? Maybe an example would help

I have a list of objects with string names, and I need to find the items that match a specific substring. The list includes items like Door, Window, Car. But sometimes it can include things like Door 2, Car 3.

So far, I can input the string “Window”, and it will match, for example, “Window” and “Window 2”. However, if I input “Window 1”, it won’t match “Window”, and for my particular use case, this is necessary. I could query all the items, and then compare them using Javascript, but this is slow. I was wondering if the Realm query language had support for something like this.

Not sure I understand.

Window 1 would not match Window unless you are attempting to find all matches that start the same (the beginning of the string), OR you toss out anything not relevant, like the ‘1’ and then do a search

In either case though, it would still be a partial string search.

I don’t believe there would be any way to match Window 1 to Window in any language - perhaps you can share a snippet of code that would perform the match? Then we can see more specifically what that does and try to come up with a Realm based solution.