I am currently debugging an old script and trying to understand a regex in an SQL query.
What would be the result of this search?
[...] REGEXP '(^| |"|\\()ORDER(-| )[[:digit:]]{3}';
I am currently debugging an old script and trying to understand a regex in an SQL query.
What would be the result of this search?
[...] REGEXP '(^| |"|\\()ORDER(-| )[[:digit:]]{3}';
Here is a part by part explanation:
(^| |"|\\()
: either the beginning of the string (^
), or a space, or a double quote, or an opening parenthese (this character needs to be escaped because it is meaningful in regexes)
ORDER
: the word "ORDER"
(-| )
: either a dash or a space
[[:digit:]]{3}
: a sequence of 3 consecutive digits (between 0 and 9)