Reputation: 49
I’m trying to understand what ~ '^[0-9]+$'
means. Would it be any integer that contains 0-9? Or doesn’t contain 0-9?
Is the ~
equivalent to LIKE in MS SQL?
Upvotes: 2
Views: 8061
Reputation: 9151
Looking at https://www.postgresql.org/docs/9.6/static/functions-matching.html#FUNCTIONS-POSIX-TABLE, you will find, that ~ means:
"Matches regular expression, case sensitive"
'^[0-9]+$'
is a regular expression, with:
I don't know how you define integer, but e.g. '0000' is matched as well.
SqlServer does not support complete regular expression syntax out of the box and like does not handle regular expressions in PostgreSQL as well, therefore it is not equivalent to ~.
Upvotes: 3