How to use more than one percentage sign in queries in OrientDB?

How to use more than one percentage sign in queries in OrientDB?

For example : select from MyNode where MyNodeText.toLowerCase() like '%text1%text2%'
This does not work
saffar4everAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David FavorLinux/LXD/WordPress/Hosting SavantCommented:
First off say what you're really trying to match.

Are you looking for a string containing % or trying to create a complex regular expression with multiple %.

The first will likely be easy. Most SQL variants support %% to escape the % character.

The second will work exactly as you have it written, at least for most SQL variants.

Docs for your version of OrientDB will provide correct answers to your questions.
0
saffar4everAuthor Commented:
Hi,

I am trying to find values that contain text1 followed by text2. any character before text1 and after text 2 is allowed and any character between them is allowed.
0
NerdsOfTechTechnology ScientistCommented:
You can use Like:
 WHERE fieldname LIKE '%text1%text2%'

Open in new window

or RegEx:
 WHERE fieldname MATCHES '.*(text1).*(text2).*'

Open in new window


https://orientdb.com/docs/2.0/orientdb.wiki/SQL-Where.html

https://regex101.com/r/cnqcSJ/4
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
awking00Information Technology SpecialistCommented:
>> any character before text1 and after text 2 is allowed and any character between them is allowed. <<
Are you saying any single character is allowed in those locations or any group of characters? Can you provide some sample data and what you expect for results (include an example where '%text1%text2%' doesn't work).
0
saffar4everAuthor Commented:
@awking00

Are you saying any single character is allowed in those locations or any group of characters?
I mean any group of characters

Can you provide some sample data and what you expect for results (include an example where '%text1%text2%' doesn't work).
Suppose the data is 'all the time'. If I search '%all%time%', the OrientDB returns nothing. I'm guessing it is a syntax problem.

@NerdsOfTech
Thank you NerdsOfTech. Regular expressions worked for me.
1
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.