[
https://issues.apache.org/jira/browse/TRAFODION-2353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15690197#comment-15690197
]
ASF GitHub Bot commented on TRAFODION-2353:
-------------------------------------------
Github user traflm commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/842#discussion_r89322438
--- 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( '[email protected]' );
+
+--- 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
+----------
+
[email protected]
+
+--- 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 --
This is correct, this test case is not proper, let me update it.
> support of the regexp operator
> ------------------------------
>
> Key: TRAFODION-2353
> URL: https://issues.apache.org/jira/browse/TRAFODION-2353
> Project: Apache Trafodion
> Issue Type: New Feature
> Reporter: liu ming
> Assignee: liu ming
>
> It is desired to have REGEXP.
> Some initial researching already done in:
> https://cwiki.apache.org/confluence/display/TRAFODION/Example+Enhancement%3A+Add+a+New+Built-in+Function
> This JIRA is to add REGEXP operator, not including functions may required
> future, if required, related JIRA will be created.
> The good advice in the wiki is to do new features incrementally.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)