This is an automated email from the ASF dual-hosted git repository.

krlawrence pushed a commit to branch TINKERPOP-2652
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 01bf2a937c9a343265468cc88dcaf72cda2564a6
Author: Kelvin Lawrence <[email protected]>
AuthorDate: Thu Nov 18 16:20:48 2021 -0600

    Initial set of regex tests
---
 .../org/apache/tinkerpop/gremlin/process/traversal/Text.java |  4 ++--
 .../apache/tinkerpop/gremlin/process/traversal/PTest.java    | 12 ++++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Text.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Text.java
index 5d443ff..91fcd7d 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Text.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Text.java
@@ -39,7 +39,7 @@ public enum Text implements BiPredicate<String, String> {
     regex {
         @Override
         public boolean test(final String value, final String regex) {
-            Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
+            Pattern pattern = Pattern.compile(regex);
             Matcher matcher = pattern.matcher(value);
             return matcher.find();   
         }
@@ -60,7 +60,7 @@ public enum Text implements BiPredicate<String, String> {
     notRegex {
         @Override
         public boolean test(final String value, final String regex) {
-           Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
+           Pattern pattern = Pattern.compile(regex);
            Matcher matcher = pattern.matcher(value);
            return !matcher.find();   
         }
diff --git 
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PTest.java
 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PTest.java
index e58e8be..401c230 100644
--- 
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PTest.java
+++ 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PTest.java
@@ -158,6 +158,18 @@ public class PTest {
                     
{TextP.containing("o").and(P.gte("j")).and(TextP.endingWith("ko")), "josh", 
false},
                     
{TextP.containing("o").and(P.gte("j").and(TextP.endingWith("ko"))), "marko", 
true},
                     
{TextP.containing("o").and(P.gte("j").and(TextP.endingWith("ko"))), "josh", 
false},
+                    {TextP.regex("^D"), "Dallas Fort Worth", true},
+                    {TextP.regex("^d"), "Dallas Fort Worth", false},
+                    {TextP.regex("^Da"), "Dallas Forth Worth", true},
+                    {TextP.regex("^da"), "Dallas Forth Worth", false},
+                    {TextP.regex("^x"), "Dallas Fort Worth", false},
+                    {TextP.regex("Dal[l|x]as"), "Dallas Fort Worth", true},
+                    {TextP.regex("Dal[f|x]as"), "Dallas Fort Worth", false},
+                    {TextP.regex("[1-9]{3}"), "123-ABC-456", true},
+                    {TextP.regex("[1-9]{3}-[A-Z]{3}-[1-9]{3}"), "123-ABC-456", 
true},
+                    {TextP.regex("[1-9]{3}-[a-z]{3}-[1-9]{3}"), "123-ABC-456", 
false},
+                    {TextP.regex("(?i)[1-9]{3}-[a-z]{3}-[1-9]{3}"), 
"123-ABC-456", true},
+                    {TextP.regex("(?i)abc"), "123-ABC-456", true},
             }));
         }
 

Reply via email to