I tested the regex in Oracle SQL and found something that I could not understand:
SELECT 1 FROM DUAL WHERE REGEXP_LIKE ('Professor Frank', '(^|\s)Prof[^\s]*(\s|$)');
The above does not match, while the following matches:
SELECT 1 FROM DUAL WHERE REGEXP_LIKE ('Professor Frank', '(^|\s)Prof\S*(\s|$)');
In other variants of regular expressions, it will be similar in \bProf[^\s]*\bcomparison with \bProf\S*\band has similar results. Note. There is no \bword boundary in the SQL SQL regular expression .
Question: Why do [^\s]*they \S*work the same in Oracle SQL?
I notice that if I delete (\s|$)at the end, the first regular expression will match.
source
share