v5.1.0 - Op.regexp add unwanted backslahes & double quotes that breaks regex.
See original GitHub issueWhat are you doing?
I try to use a regex to match one or many terms in the column.
let services = ['First'];
Model.findAll({
where: {
column: {
[Op.regexp]: services[0]
}
}
});
What do you expect to happen?
I want that the mysql request look like that :
`Model`.`column` REGEXP 'First'
What is actually happening?
Backslahes and doubles quotes are added in the generated request.
`Model`.`column` REGEXP '\"First\"'
Dialect: mysql Dialect version: NA Database version: 5.7.25-0ubuntu0.18.04.2 Sequelize version: 5.1.0 Tested with latest release: Yes (5.1.0)
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
What's the regex to match anything except a double quote not ...
So: match quotes, and inside them: every character except a quote ... That is, a double-quote preceded by two backslashes, where in most ......
Read more >RegexBuddy PDF
enter with a backslash. Metacharacters are characters that have a special meaning in regular expressions. Non-Printable Character.
Read more >RegexMagic Manual
Start with adding samples of the text that your regular expression should ... The source code snippet automatically sets the “dot matches line...
Read more >Regex for Quoted String with escapable quotes - Metal Toad
The next important thing to realize is that the last character before the ending quote will not get matched. That's why we add...
Read more >Regular Expressions :: Eloquent JavaScript
First, since a forward slash ends the pattern, we need to put a backslash before any forward slash that we want to be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for you quick answer and your temp fix.
So now I use
that works like a charm !
For now try using
literal(YOUR_VALUE)
while I look into a bug fix.