Package java.util.regex

Examples of java.util.regex.Pattern.pattern()


            condition.left = analyzeNode(node);
            condition.operation = BooleanOperator.MATCHES;
            RegExMatch regExNode = (RegExMatch)node;
            Pattern pattern = regExNode.getPattern();
            if (pattern != null) {
                condition.right = new FixedExpression(String.class, pattern.pattern());
            } else {
                condition.right = analyzeNode(((ExecutableAccessor)regExNode.getPatternStatement()).getNode());
            }
        } else if (node instanceof Contains) {
            condition.left = analyzeNode(((Contains)node).getFirstStatement());
View Full Code Here


    @Override
    public void marshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context) {
        final Pattern pattern = (Pattern)source;
        writer.startNode("pattern");
        writer.setValue(pattern.pattern());
        writer.endNode();
        writer.startNode("flags");
        writer.setValue(String.valueOf(pattern.flags()));
        writer.endNode();
    }
View Full Code Here

            condition.right = analyzeNode(binaryOperation.getRight());
        } else if (node instanceof RegExMatch) {
            condition.left = analyzeNode(node);
            condition.operation = BooleanOperator.MATCHES;
            Pattern pattern = ((RegExMatch)node).getPattern();
            condition.right = new FixedExpression(String.class, pattern.pattern());
        } else if (node instanceof Contains) {
            condition.left = analyzeNode(((Contains)node).getFirstStatement());
            condition.operation = BooleanOperator.CONTAINS;
            condition.right = analyzeNode(((Contains)node).getSecondStatement());
        } else if (node instanceof Soundslike) {
View Full Code Here

               (highlightColumn == adapter.convertColumnIndexToModel(adapter.column)));
    }

    private boolean isEnabled() {
        Pattern pattern = getPattern();
        if (pattern == null || MATCH_ALL.equals(pattern.pattern())) {
            return false;
        }
        return true;
    }
View Full Code Here

   public void testRegex()
   {
      String[] files = {".java", "x.java", "FooBar.java"};
      String expression = "*.java";
      Pattern p = AssembledDirectory.getPattern(expression);
      System.out.println("pattern: " + p.pattern());
      for (String file : files)
      {
         assertTrue(p.matcher(file).matches());
      }
      System.out.println("no matches");
View Full Code Here

        assertFalse(pattern.matcher("org.gwtoolbox.client.annotations").matches());
    }

    public void testResolvePattern_regexp() throws Exception {
        Pattern pattern = PatternUtils.resolvePattern("org.gwtoolbox.client", PackageResolver.REGEXP);
        assertEquals("org.gwtoolbox.client", pattern.pattern());
    }
   
}
View Full Code Here

         if (finAccountCode == null) {
             return null;
         }

         Pattern filterRegex = Pattern.compile("[^0-9A-Z]");
         finAccountCode = finAccountCode.toUpperCase().replaceAll(filterRegex.pattern(), "");

         // now we need to get the encrypted version of the fin account code the user passed in to look up against FinAccount
         // we do this by making a temporary generic entity with same finAccountCode and then doing a match
         ModelEntity finAccountEntity = delegator.getModelEntity("FinAccount");
         GenericEntity encryptedFinAccount = GenericEntity.createGenericEntity(finAccountEntity, UtilMisc.toMap("finAccountCode", finAccountCode));
View Full Code Here

        Pattern regex;

        String expectedPattern = "(" + basedir + "/(easy\\.txt))|(" + basedir + "/(test\\.txt))";

        regex = assertPatternsRegex(realBasedir, expectedPattern, "easy.txt", "test.txt");
        assert regex.matcher(basedir + "/easy.txt").matches() : regex.pattern() + " vs. " + basedir + "/easy.txt";
        assert regex.matcher(basedir + "/test.txt").matches();
        assert !regex.matcher(basedir + "/easyXtxt").matches();
        assert !regex.matcher(basedir + "/testXtxt").matches();
        assert !regex.matcher(basedir + "/easy.txtX").matches();
        assert !regex.matcher(basedir + "/test.txtX").matches();
View Full Code Here

            fileSets.add(fileSet);
        }
        Pattern regex = AbstractBundleType.getPattern(fileSets);

        assert regex != null : "The regex was not able to be produced - it was null";
        assert expectedPattern.equals(regex.pattern()) : "The expected pattern [" + expectedPattern
            + "] did not match the actual pattern [" + regex.pattern() + "]";

        return regex;
    }
View Full Code Here

        }
        Pattern regex = AbstractBundleType.getPattern(fileSets);

        assert regex != null : "The regex was not able to be produced - it was null";
        assert expectedPattern.equals(regex.pattern()) : "The expected pattern [" + expectedPattern
            + "] did not match the actual pattern [" + regex.pattern() + "]";

        return regex;
    }

    public void testBuildIncludePatternRegex() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.