Github user zellerh commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/842#discussion_r89219756 --- Diff: core/sql/regress/executor/EXPECTED002.SB --- @@ -6713,6 +6713,90 @@ s3 100-90-40 >>drop table student; --- SQL operation complete. +>>drop table if exists regexp_test; + +--- SQL operation complete. +>>create table regexp_test (c1 char(32) ); + +--- SQL operation complete. +>>insert into regexp_test values( '123' ); + +--- 1 row(s) inserted. +>>insert into regexp_test values( '123a' ); + +--- 1 row(s) inserted. +>>insert into regexp_test values( 'english' ); + +--- 1 row(s) inserted. +>>insert into regexp_test values( 'd...@trafodion.org' ); + +--- 1 row(s) inserted. +>>insert into regexp_test values( '127.0.0.1' ); + +--- 1 row(s) inserted. +>>insert into regexp_test values( '127.0.0.300' ); + +--- 1 row(s) inserted. +>>insert into regexp_test values('ä¸ææµè¯'); + +--- 1 row(s) inserted. +>> +>>-- only number +>>select * from regexp_test where c1 regexp '^[0-9]*\s*$'; + +C1 +---------- + +123 + +--- 1 row(s) selected. +>>select * from regexp_test where c1 regexp '^[[:digit:]]*\s*$'; + +C1 +---------- + +123 + +--- 1 row(s) selected. +>>-- only english +>>select * from regexp_test where c1 regexp '^.[A-Za-z]+\s*$'; + +C1 +---------- + +english + +--- 1 row(s) selected. +>>-- valid email address +>>select * from regexp_test where c1 regexp '\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*\s*'; + +C1 +---------- + +d...@trafodion.org + +--- 1 row(s) selected. +>>-- valid ip address +>>select * from regexp_test where c1 regexp '^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])\s*$'; + +C1 +---------- + +127.0.0.1 + +--- 1 row(s) selected. +>>-- utf-8 code +>>select * from regexp_test where c1 regexp '[ä¸ææµè¯]'; --- End diff -- I don't quite understand why this matches. Isn't the square bracket notation giving a choice of different characters? So, this would match a string of length 1 with any of the Chinese characters in the list, but not multiple characters?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---