Package java.util.regex

Examples of java.util.regex.Pattern$UnixDot


        String uniqueRandomFileName = MessageFormat.format(pattern, new Object[] { date, date });
        return new File(directory, uniqueRandomFileName);
    }

    public static String unescapeEntities(String str) {
        Pattern hexEntityPattern = Pattern.compile("&([a-fA-F0-9]+);");
        Pattern decimalEntityPattern = Pattern.compile("&#([0-9]+);");
        str = replaceNumericEntities(str, hexEntityPattern, 16);
        return replaceNumericEntities(str, decimalEntityPattern, 10);
    }
View Full Code Here


        //if you change anything, we'll destroy our combined search pattern. This will recreate it with the
        //latest settings when its next asked for.
        combinedSearchPattern = null;

        String searchExpression = fileLinkDefinition.getSearchExpression();
        Pattern pattern = Pattern.compile( searchExpression, getSearchPatternFlags() );
        destinationMap.put( pattern, fileLinkDefinition);
    }
View Full Code Here

   private static FileLinkDefinition getMatchingFileLinkDefinition( String text, Map<Pattern,FileLinkDefinition> map )
   {
      Iterator<Pattern> iterator = map.keySet().iterator();
      while( iterator.hasNext() )
      {
         Pattern pattern = iterator.next();
         Matcher matcher = pattern.matcher( text );
         if( matcher.find( 0 ) )
         {
            return map.get( pattern );
         }
      }
View Full Code Here

    */
   public List<FileLink> parseText( String text )
   {
      List<FileLink> fileLinks = new ArrayList<FileLink>();

      Pattern combinedSearchPattern = fileLinkDefinitionLord.getSearchPattern();
      Matcher matcher = combinedSearchPattern.matcher( text );

      int index = 0;

      boolean foundAMatch = matcher.find( index );
      while( foundAMatch )
View Full Code Here

        if (pattern.length() == 0) {
            return null;
        }

        Pattern camelCasePattern = getPatternForName(pattern);
        Pattern normalisedCamelCasePattern = Pattern.compile(camelCasePattern.pattern(), Pattern.CASE_INSENSITIVE);
        String normalisedPattern = pattern.toUpperCase();

        Set<String> matches1 = new TreeSet<String>();
        Set<String> matches2 = new TreeSet<String>();

        for (String candidate : items) {
            if (camelCasePattern.matcher(candidate).matches()) {
                matches1.add(candidate);
                continue;
            }
            if (normalisedCamelCasePattern.matcher(candidate).lookingAt()) {
                matches2.add(candidate);
                continue;
            }
            if (StringUtils.getLevenshteinDistance(normalisedPattern, candidate.toUpperCase()) <= Math.min(3,
                    pattern.length() / 2)) {
View Full Code Here

        return null;
    }

    private static Pattern getPatternForName(String name) {
        Pattern boundaryPattern = Pattern.compile("((^|\\p{Punct})\\p{javaLowerCase}+)|(\\p{javaUpperCase}\\p{javaLowerCase}*)");
        Matcher matcher = boundaryPattern.matcher(name);
        int pos = 0;
        StringBuilder builder = new StringBuilder();
        while (matcher.find()) {
            String prefix = name.substring(pos, matcher.start());
            if (prefix.length() > 0) {
View Full Code Here

    if (sourceRef != null) {
      ContentNetworkUtils.setSourceRef(tabID, sourceRef, false);

      if (MultipleDocumentInterface.SIDEBAR_SECTION_PLUS.equals(tabID) ||
          MultipleDocumentInterface.SIDEBAR_SECTION_BURN_INFO.equals(tabID)) {
        Pattern pattern = Pattern.compile("http.*//[^/]+/([^.]+)");
        Matcher matcher = pattern.matcher(sourceRef);
       
        String sourceRef2;
        if (matcher.find()) {
          sourceRef2 = matcher.group(1);
        } else {
View Full Code Here

        Set<ValidationError> errors = new HashSet<ValidationError>();
        if (stringConstraint != null) {
            if (stringConstraint.required() & (object == null)) errors.add(new ValidationError(field.getName(), errorCodes[0], stringConstraint, object));
            if ((object != null) & (stringConstraint.regexp().length() > 0)) {
                try {
                    Pattern pattern = Pattern.compile(stringConstraint.regexp());
                    Matcher matcher = pattern.matcher(object.toString());
                    if (!matcher.matches()) errors.add(new ValidationError(field.getName(), errorCodes[1], stringConstraint, object));
                } catch (Exception ex) {
                    throw new ValidationException(ex);
                }
            }
View Full Code Here

                }
            }
           
            String regex = DcModules.get(getModule()).getSettings().getString(DcRepository.ModuleSettings.stTitleCleanupRegex);
            if (!Utilities.isEmpty(regex)) {
                Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE | Pattern.MULTILINE);
                Matcher matcher = pattern.matcher(name);
                while (matcher.find())
                    name = matcher.replaceAll("");
            }
        }
       
View Full Code Here

        return replaceSystemProperties(configTool.getAttributeValue(Config.VALUE_KEY_WORD));
    }

    public static String replaceSystemProperties(String oldString) {
        Pattern p = Pattern.compile("\\$\\{[^\\}]*\\}");
        Matcher m = p.matcher(oldString);
        StringBuffer sb = new StringBuffer();
        while (m.find()) {
            String pp = m.group();
            String rep = null;
            if (pp.length() > 3) {
View Full Code Here

TOP

Related Classes of java.util.regex.Pattern$UnixDot

Copyright © 2018 www.massapicom. 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.