MYSQL REGEX search many words with no order conditionHow to negate specific word in regex?Has anyone found that REGEX “b” doesn't work in MYSQL?MySQL and word boundary in regexMySQL matching this regex while it shouldn'tregex word boundary will not work with diacritic charactersNOT words in Regex PatternExtract words using regexWhole word regex js unicodeMySQL REGEXP doesn't return expected result for Arabic-based regexRegex multi word boundry (exact word)
Why did a party with more votes get fewer seats in the 2019 European Parliament election in Denmark?
How do I write "Show, Don't Tell" as an Asperger?
How hard would it be to convert a glider into an powered electric aircraft?
Adding two lambda-functions in C++
Can't login after removing Flatpak
Avoiding cliches when writing gods
Did Darth Vader wear the same suit for 20+ years?
Does an ice chest packed full of frozen food need ice? 18 day Grand Canyon trip
Importance sampling estimation of power function
How to make a setting relevant?
How can this map be coloured using four colours?
What's the correct term describing the action of sending a brand-new ship out into its first seafaring trip?
What is the purpose of building foundations?
How is it possible that Gollum speaks Westron?
How were concentration and extermination camp guards recruited?
Function to extract float from different price patterns
Why don’t airliners have temporary liveries?
Using conduit with THHN
Implement Homestuck's Catenative Doomsday Dice Cascader
Completing the square to find if quadratic form is positive definite.
What risks are there when you clear your cookies instead of logging off?
Whats the next step after commercial fusion reactors?
How can drunken, homicidal elves successfully conduct a wild hunt?
How to skip replacing first occurrence of a character in each line?
MYSQL REGEX search many words with no order condition
How to negate specific word in regex?Has anyone found that REGEX “b” doesn't work in MYSQL?MySQL and word boundary in regexMySQL matching this regex while it shouldn'tregex word boundary will not work with diacritic charactersNOT words in Regex PatternExtract words using regexWhole word regex js unicodeMySQL REGEXP doesn't return expected result for Arabic-based regexRegex multi word boundry (exact word)
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I try to use a regex with mysql that search boundary words in a json array string but I don't want the regex match words order because I don't know them.
So I started firstly to write my regex on regex101 (https://regex101.com/r/wNVyaZ/1) and then try to convert this one for mysql.
WHERE `Wish`.`services` REGEXP '^([^>].*[[:<:]]Hygiène[[:>:]])([^>].*[[:<:]]Radiothérapie[[:>:]]).+';
WHERE `Wish`.`services` REGEXP '^([^>].*[[:<:]]Hygiène[[:>:]])([^>].*[[:<:]]Andrologie[[:>:]]).+';
In the first query I get result, cause "Hygiène" is before "Radiothérapie" but in the second query "Andrologie" is before "Hygiène" and not after like it written in the query. The problem is that the query is generated automatically with a list of services that are choosen with no order importance and I want to match only boundary words if they exists no matter the order they have.
mysql regex database
|
show 3 more comments
I try to use a regex with mysql that search boundary words in a json array string but I don't want the regex match words order because I don't know them.
So I started firstly to write my regex on regex101 (https://regex101.com/r/wNVyaZ/1) and then try to convert this one for mysql.
WHERE `Wish`.`services` REGEXP '^([^>].*[[:<:]]Hygiène[[:>:]])([^>].*[[:<:]]Radiothérapie[[:>:]]).+';
WHERE `Wish`.`services` REGEXP '^([^>].*[[:<:]]Hygiène[[:>:]])([^>].*[[:<:]]Andrologie[[:>:]]).+';
In the first query I get result, cause "Hygiène" is before "Radiothérapie" but in the second query "Andrologie" is before "Hygiène" and not after like it written in the query. The problem is that the query is generated automatically with a list of services that are choosen with no order importance and I want to match only boundary words if they exists no matter the order they have.
mysql regex database
What are you asking for? If the query is generated automatically, can you change the code that generates the query?
– Bill Karwin
Mar 24 at 14:49
Can you show an example of the JSON that you are trying to search? It's hard to know what you mean by boundary words. It's best if you show some examples of data that should satisfy your search and some examples that don't satisfy the search.
– Bill Karwin
Mar 24 at 14:51
Bill Karwin You can look in the regex101 link that I've share, this is the string that I'm searching on :"["Andrologie","Angiologie","Hygiène","Radiothérapie"]"
– Сорок два
Mar 24 at 15:17
And it's only based on this string, but the result change depending the words order in the regex. So I just want to trigger this string with regexp no matter the order of the words in the regex.
– Сорок два
Mar 24 at 15:23
1
Are you using MySQL 5.7 or 8.0? There are functions to work with JSON data that would be able to search for specific values more easily, without using REGEXP. See dev.mysql.com/doc/refman/8.0/en/…
– Bill Karwin
Mar 24 at 15:29
|
show 3 more comments
I try to use a regex with mysql that search boundary words in a json array string but I don't want the regex match words order because I don't know them.
So I started firstly to write my regex on regex101 (https://regex101.com/r/wNVyaZ/1) and then try to convert this one for mysql.
WHERE `Wish`.`services` REGEXP '^([^>].*[[:<:]]Hygiène[[:>:]])([^>].*[[:<:]]Radiothérapie[[:>:]]).+';
WHERE `Wish`.`services` REGEXP '^([^>].*[[:<:]]Hygiène[[:>:]])([^>].*[[:<:]]Andrologie[[:>:]]).+';
In the first query I get result, cause "Hygiène" is before "Radiothérapie" but in the second query "Andrologie" is before "Hygiène" and not after like it written in the query. The problem is that the query is generated automatically with a list of services that are choosen with no order importance and I want to match only boundary words if they exists no matter the order they have.
mysql regex database
I try to use a regex with mysql that search boundary words in a json array string but I don't want the regex match words order because I don't know them.
So I started firstly to write my regex on regex101 (https://regex101.com/r/wNVyaZ/1) and then try to convert this one for mysql.
WHERE `Wish`.`services` REGEXP '^([^>].*[[:<:]]Hygiène[[:>:]])([^>].*[[:<:]]Radiothérapie[[:>:]]).+';
WHERE `Wish`.`services` REGEXP '^([^>].*[[:<:]]Hygiène[[:>:]])([^>].*[[:<:]]Andrologie[[:>:]]).+';
In the first query I get result, cause "Hygiène" is before "Radiothérapie" but in the second query "Andrologie" is before "Hygiène" and not after like it written in the query. The problem is that the query is generated automatically with a list of services that are choosen with no order importance and I want to match only boundary words if they exists no matter the order they have.
mysql regex database
mysql regex database
asked Mar 24 at 14:45
Сорок дваСорок два
62
62
What are you asking for? If the query is generated automatically, can you change the code that generates the query?
– Bill Karwin
Mar 24 at 14:49
Can you show an example of the JSON that you are trying to search? It's hard to know what you mean by boundary words. It's best if you show some examples of data that should satisfy your search and some examples that don't satisfy the search.
– Bill Karwin
Mar 24 at 14:51
Bill Karwin You can look in the regex101 link that I've share, this is the string that I'm searching on :"["Andrologie","Angiologie","Hygiène","Radiothérapie"]"
– Сорок два
Mar 24 at 15:17
And it's only based on this string, but the result change depending the words order in the regex. So I just want to trigger this string with regexp no matter the order of the words in the regex.
– Сорок два
Mar 24 at 15:23
1
Are you using MySQL 5.7 or 8.0? There are functions to work with JSON data that would be able to search for specific values more easily, without using REGEXP. See dev.mysql.com/doc/refman/8.0/en/…
– Bill Karwin
Mar 24 at 15:29
|
show 3 more comments
What are you asking for? If the query is generated automatically, can you change the code that generates the query?
– Bill Karwin
Mar 24 at 14:49
Can you show an example of the JSON that you are trying to search? It's hard to know what you mean by boundary words. It's best if you show some examples of data that should satisfy your search and some examples that don't satisfy the search.
– Bill Karwin
Mar 24 at 14:51
Bill Karwin You can look in the regex101 link that I've share, this is the string that I'm searching on :"["Andrologie","Angiologie","Hygiène","Radiothérapie"]"
– Сорок два
Mar 24 at 15:17
And it's only based on this string, but the result change depending the words order in the regex. So I just want to trigger this string with regexp no matter the order of the words in the regex.
– Сорок два
Mar 24 at 15:23
1
Are you using MySQL 5.7 or 8.0? There are functions to work with JSON data that would be able to search for specific values more easily, without using REGEXP. See dev.mysql.com/doc/refman/8.0/en/…
– Bill Karwin
Mar 24 at 15:29
What are you asking for? If the query is generated automatically, can you change the code that generates the query?
– Bill Karwin
Mar 24 at 14:49
What are you asking for? If the query is generated automatically, can you change the code that generates the query?
– Bill Karwin
Mar 24 at 14:49
Can you show an example of the JSON that you are trying to search? It's hard to know what you mean by boundary words. It's best if you show some examples of data that should satisfy your search and some examples that don't satisfy the search.
– Bill Karwin
Mar 24 at 14:51
Can you show an example of the JSON that you are trying to search? It's hard to know what you mean by boundary words. It's best if you show some examples of data that should satisfy your search and some examples that don't satisfy the search.
– Bill Karwin
Mar 24 at 14:51
Bill Karwin You can look in the regex101 link that I've share, this is the string that I'm searching on :
"["Andrologie","Angiologie","Hygiène","Radiothérapie"]"
– Сорок два
Mar 24 at 15:17
Bill Karwin You can look in the regex101 link that I've share, this is the string that I'm searching on :
"["Andrologie","Angiologie","Hygiène","Radiothérapie"]"
– Сорок два
Mar 24 at 15:17
And it's only based on this string, but the result change depending the words order in the regex. So I just want to trigger this string with regexp no matter the order of the words in the regex.
– Сорок два
Mar 24 at 15:23
And it's only based on this string, but the result change depending the words order in the regex. So I just want to trigger this string with regexp no matter the order of the words in the regex.
– Сорок два
Mar 24 at 15:23
1
1
Are you using MySQL 5.7 or 8.0? There are functions to work with JSON data that would be able to search for specific values more easily, without using REGEXP. See dev.mysql.com/doc/refman/8.0/en/…
– Bill Karwin
Mar 24 at 15:29
Are you using MySQL 5.7 or 8.0? There are functions to work with JSON data that would be able to search for specific values more easily, without using REGEXP. See dev.mysql.com/doc/refman/8.0/en/…
– Bill Karwin
Mar 24 at 15:29
|
show 3 more comments
2 Answers
2
active
oldest
votes
You can search for words in JSON like the following (I tested on MySQL 5.7):
select * from wish
where json_search(services, 'one', 'Hygiène') is not null
and json_search(services, 'one', 'Andrologie') is not null;
+------------------------------------------------------------+
| services |
+------------------------------------------------------------+
| ["Andrologie", "Angiologie", "Hygiène", "Radiothérapie"] |
+------------------------------------------------------------+
See https://dev.mysql.com/doc/refman/5.7/en/json-search-functions.html#function_json-search
Thanks for this answer but I now use mysql 8 and the requestsql SELECT * FROM `Wishes` WHERE json_search(services, 'one', 'Hygiène');
orsql SELECT * FROM `Wishes` WHERE json_search(services, 'one', 'Hygiène') is not null AND json_search(services, 'one', 'Andrologie') is not null;
doesn't return anything
– Сорок два
Mar 24 at 18:46
Why is that? Could it be there is no row where both words occur in the same JSON document in your data?
– Bill Karwin
Mar 24 at 20:09
add a comment |
If you can, use the JSON search queries (you need a MySQL with JSON support).
If it's advisable, consider changing the database structure and enter the various "words" as a related table. This would allow you much more powerful (and faster) queries.
JOIN has_service AS hh ON (hh.row_id = id)
JOIN services AS ss ON (hh.service_id = ss.id
AND ss.name IN ('Hygiène', 'Angiologie', ...)
Otherwise, in this context, consider that you're not really doing a regexp search, and you're doing a full table scan anyway (unless MySQL 8.0+ or PerconaDB 5.7+ (not sure) and an index on the full extent of the 'services' column), and several LIKE queries will actually cost you less:
WHERE (services LIKE '%"Hygiène"%'
OR services LIKE '%"Angiologie"%'
...)
or
IF(services LIKE '%"Hygiène"%', 1, 0)
+IF(services LIKE '%"Angiologie"%', 1, 0)
+ ... AS score
HAVING score > 0 -- or score=5 if you want only matches on all full five
ORDER BY score DESC;
Thanks for you answer. I'll consider changing my json format to use your first solution.
– Сорок два
Mar 24 at 18:52
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55324962%2fmysql-regex-search-many-words-with-no-order-condition%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can search for words in JSON like the following (I tested on MySQL 5.7):
select * from wish
where json_search(services, 'one', 'Hygiène') is not null
and json_search(services, 'one', 'Andrologie') is not null;
+------------------------------------------------------------+
| services |
+------------------------------------------------------------+
| ["Andrologie", "Angiologie", "Hygiène", "Radiothérapie"] |
+------------------------------------------------------------+
See https://dev.mysql.com/doc/refman/5.7/en/json-search-functions.html#function_json-search
Thanks for this answer but I now use mysql 8 and the requestsql SELECT * FROM `Wishes` WHERE json_search(services, 'one', 'Hygiène');
orsql SELECT * FROM `Wishes` WHERE json_search(services, 'one', 'Hygiène') is not null AND json_search(services, 'one', 'Andrologie') is not null;
doesn't return anything
– Сорок два
Mar 24 at 18:46
Why is that? Could it be there is no row where both words occur in the same JSON document in your data?
– Bill Karwin
Mar 24 at 20:09
add a comment |
You can search for words in JSON like the following (I tested on MySQL 5.7):
select * from wish
where json_search(services, 'one', 'Hygiène') is not null
and json_search(services, 'one', 'Andrologie') is not null;
+------------------------------------------------------------+
| services |
+------------------------------------------------------------+
| ["Andrologie", "Angiologie", "Hygiène", "Radiothérapie"] |
+------------------------------------------------------------+
See https://dev.mysql.com/doc/refman/5.7/en/json-search-functions.html#function_json-search
Thanks for this answer but I now use mysql 8 and the requestsql SELECT * FROM `Wishes` WHERE json_search(services, 'one', 'Hygiène');
orsql SELECT * FROM `Wishes` WHERE json_search(services, 'one', 'Hygiène') is not null AND json_search(services, 'one', 'Andrologie') is not null;
doesn't return anything
– Сорок два
Mar 24 at 18:46
Why is that? Could it be there is no row where both words occur in the same JSON document in your data?
– Bill Karwin
Mar 24 at 20:09
add a comment |
You can search for words in JSON like the following (I tested on MySQL 5.7):
select * from wish
where json_search(services, 'one', 'Hygiène') is not null
and json_search(services, 'one', 'Andrologie') is not null;
+------------------------------------------------------------+
| services |
+------------------------------------------------------------+
| ["Andrologie", "Angiologie", "Hygiène", "Radiothérapie"] |
+------------------------------------------------------------+
See https://dev.mysql.com/doc/refman/5.7/en/json-search-functions.html#function_json-search
You can search for words in JSON like the following (I tested on MySQL 5.7):
select * from wish
where json_search(services, 'one', 'Hygiène') is not null
and json_search(services, 'one', 'Andrologie') is not null;
+------------------------------------------------------------+
| services |
+------------------------------------------------------------+
| ["Andrologie", "Angiologie", "Hygiène", "Radiothérapie"] |
+------------------------------------------------------------+
See https://dev.mysql.com/doc/refman/5.7/en/json-search-functions.html#function_json-search
answered Mar 24 at 17:28
Bill KarwinBill Karwin
391k65526682
391k65526682
Thanks for this answer but I now use mysql 8 and the requestsql SELECT * FROM `Wishes` WHERE json_search(services, 'one', 'Hygiène');
orsql SELECT * FROM `Wishes` WHERE json_search(services, 'one', 'Hygiène') is not null AND json_search(services, 'one', 'Andrologie') is not null;
doesn't return anything
– Сорок два
Mar 24 at 18:46
Why is that? Could it be there is no row where both words occur in the same JSON document in your data?
– Bill Karwin
Mar 24 at 20:09
add a comment |
Thanks for this answer but I now use mysql 8 and the requestsql SELECT * FROM `Wishes` WHERE json_search(services, 'one', 'Hygiène');
orsql SELECT * FROM `Wishes` WHERE json_search(services, 'one', 'Hygiène') is not null AND json_search(services, 'one', 'Andrologie') is not null;
doesn't return anything
– Сорок два
Mar 24 at 18:46
Why is that? Could it be there is no row where both words occur in the same JSON document in your data?
– Bill Karwin
Mar 24 at 20:09
Thanks for this answer but I now use mysql 8 and the request
sql SELECT * FROM `Wishes` WHERE json_search(services, 'one', 'Hygiène');
or sql SELECT * FROM `Wishes` WHERE json_search(services, 'one', 'Hygiène') is not null AND json_search(services, 'one', 'Andrologie') is not null;
doesn't return anything– Сорок два
Mar 24 at 18:46
Thanks for this answer but I now use mysql 8 and the request
sql SELECT * FROM `Wishes` WHERE json_search(services, 'one', 'Hygiène');
or sql SELECT * FROM `Wishes` WHERE json_search(services, 'one', 'Hygiène') is not null AND json_search(services, 'one', 'Andrologie') is not null;
doesn't return anything– Сорок два
Mar 24 at 18:46
Why is that? Could it be there is no row where both words occur in the same JSON document in your data?
– Bill Karwin
Mar 24 at 20:09
Why is that? Could it be there is no row where both words occur in the same JSON document in your data?
– Bill Karwin
Mar 24 at 20:09
add a comment |
If you can, use the JSON search queries (you need a MySQL with JSON support).
If it's advisable, consider changing the database structure and enter the various "words" as a related table. This would allow you much more powerful (and faster) queries.
JOIN has_service AS hh ON (hh.row_id = id)
JOIN services AS ss ON (hh.service_id = ss.id
AND ss.name IN ('Hygiène', 'Angiologie', ...)
Otherwise, in this context, consider that you're not really doing a regexp search, and you're doing a full table scan anyway (unless MySQL 8.0+ or PerconaDB 5.7+ (not sure) and an index on the full extent of the 'services' column), and several LIKE queries will actually cost you less:
WHERE (services LIKE '%"Hygiène"%'
OR services LIKE '%"Angiologie"%'
...)
or
IF(services LIKE '%"Hygiène"%', 1, 0)
+IF(services LIKE '%"Angiologie"%', 1, 0)
+ ... AS score
HAVING score > 0 -- or score=5 if you want only matches on all full five
ORDER BY score DESC;
Thanks for you answer. I'll consider changing my json format to use your first solution.
– Сорок два
Mar 24 at 18:52
add a comment |
If you can, use the JSON search queries (you need a MySQL with JSON support).
If it's advisable, consider changing the database structure and enter the various "words" as a related table. This would allow you much more powerful (and faster) queries.
JOIN has_service AS hh ON (hh.row_id = id)
JOIN services AS ss ON (hh.service_id = ss.id
AND ss.name IN ('Hygiène', 'Angiologie', ...)
Otherwise, in this context, consider that you're not really doing a regexp search, and you're doing a full table scan anyway (unless MySQL 8.0+ or PerconaDB 5.7+ (not sure) and an index on the full extent of the 'services' column), and several LIKE queries will actually cost you less:
WHERE (services LIKE '%"Hygiène"%'
OR services LIKE '%"Angiologie"%'
...)
or
IF(services LIKE '%"Hygiène"%', 1, 0)
+IF(services LIKE '%"Angiologie"%', 1, 0)
+ ... AS score
HAVING score > 0 -- or score=5 if you want only matches on all full five
ORDER BY score DESC;
Thanks for you answer. I'll consider changing my json format to use your first solution.
– Сорок два
Mar 24 at 18:52
add a comment |
If you can, use the JSON search queries (you need a MySQL with JSON support).
If it's advisable, consider changing the database structure and enter the various "words" as a related table. This would allow you much more powerful (and faster) queries.
JOIN has_service AS hh ON (hh.row_id = id)
JOIN services AS ss ON (hh.service_id = ss.id
AND ss.name IN ('Hygiène', 'Angiologie', ...)
Otherwise, in this context, consider that you're not really doing a regexp search, and you're doing a full table scan anyway (unless MySQL 8.0+ or PerconaDB 5.7+ (not sure) and an index on the full extent of the 'services' column), and several LIKE queries will actually cost you less:
WHERE (services LIKE '%"Hygiène"%'
OR services LIKE '%"Angiologie"%'
...)
or
IF(services LIKE '%"Hygiène"%', 1, 0)
+IF(services LIKE '%"Angiologie"%', 1, 0)
+ ... AS score
HAVING score > 0 -- or score=5 if you want only matches on all full five
ORDER BY score DESC;
If you can, use the JSON search queries (you need a MySQL with JSON support).
If it's advisable, consider changing the database structure and enter the various "words" as a related table. This would allow you much more powerful (and faster) queries.
JOIN has_service AS hh ON (hh.row_id = id)
JOIN services AS ss ON (hh.service_id = ss.id
AND ss.name IN ('Hygiène', 'Angiologie', ...)
Otherwise, in this context, consider that you're not really doing a regexp search, and you're doing a full table scan anyway (unless MySQL 8.0+ or PerconaDB 5.7+ (not sure) and an index on the full extent of the 'services' column), and several LIKE queries will actually cost you less:
WHERE (services LIKE '%"Hygiène"%'
OR services LIKE '%"Angiologie"%'
...)
or
IF(services LIKE '%"Hygiène"%', 1, 0)
+IF(services LIKE '%"Angiologie"%', 1, 0)
+ ... AS score
HAVING score > 0 -- or score=5 if you want only matches on all full five
ORDER BY score DESC;
edited Mar 24 at 19:06
answered Mar 24 at 17:37
LSerniLSerni
41.8k74982
41.8k74982
Thanks for you answer. I'll consider changing my json format to use your first solution.
– Сорок два
Mar 24 at 18:52
add a comment |
Thanks for you answer. I'll consider changing my json format to use your first solution.
– Сорок два
Mar 24 at 18:52
Thanks for you answer. I'll consider changing my json format to use your first solution.
– Сорок два
Mar 24 at 18:52
Thanks for you answer. I'll consider changing my json format to use your first solution.
– Сорок два
Mar 24 at 18:52
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55324962%2fmysql-regex-search-many-words-with-no-order-condition%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What are you asking for? If the query is generated automatically, can you change the code that generates the query?
– Bill Karwin
Mar 24 at 14:49
Can you show an example of the JSON that you are trying to search? It's hard to know what you mean by boundary words. It's best if you show some examples of data that should satisfy your search and some examples that don't satisfy the search.
– Bill Karwin
Mar 24 at 14:51
Bill Karwin You can look in the regex101 link that I've share, this is the string that I'm searching on :
"["Andrologie","Angiologie","Hygiène","Radiothérapie"]"
– Сорок два
Mar 24 at 15:17
And it's only based on this string, but the result change depending the words order in the regex. So I just want to trigger this string with regexp no matter the order of the words in the regex.
– Сорок два
Mar 24 at 15:23
1
Are you using MySQL 5.7 or 8.0? There are functions to work with JSON data that would be able to search for specific values more easily, without using REGEXP. See dev.mysql.com/doc/refman/8.0/en/…
– Bill Karwin
Mar 24 at 15:29