On the Couchbase documentation
https://docs.couchbase.com/server/6.0/n1ql/n1ql-language-reference/patternmatchingfun.html
I saw that:
REGEXP_CONTAINS(expression, pattern)
Returns True if the string value contains the regular expression pattern.
REGEXP_LIKE(expression, pattern)
Returns True if the string value contains the regular expression pattern.
Is there any difference between this functions or one is an alias for another?
REGEXP_LIKE() requires that the expression exactly match the pattern. REGEXP_CONTAINS() is less restrictive; the expression only has to contain something that matches the pattern.
This query illustrates the difference. Note that the pattern being searched for is the second parameter to the function.
select REGEXP_CONTAINS(" foof ", "foof") as contains, REGEXP_LIKE(" foof ", "foof") as `like`
[
{
"contains": true,
"like": false
}
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With