Package java.util.regex

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


        int iEarliest = -1;
        String s = filter.regex ? filter.text : "\\Q" + filter.text + "\\E";
        Pattern pattern = Pattern.compile(s, Pattern.CASE_INSENSITIVE);
        for (int i = 0; i < cells.length; i++) {
          Matcher m = pattern.matcher(cells[i].getText());
          if (m.find() && (m.start() < iEarliest || iEarliest == -1)) {
            iEarliest = m.start();
            index = i;
          }
        }
View Full Code Here


   {
      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

        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

      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

        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

     * @return Parsed unique name
     */
    public static List<String> parseUniqueName(String uniqueName) {
        List<String> trail = new ArrayList<String>();
        Pattern regex = Pattern.compile("([^\\[\\]\\.]*)");
        Matcher matcher = regex.matcher(uniqueName);
        while (matcher.find()) {
            String match = matcher.group();
            if (!match.equals("")) {
                trail.add(match);
            }
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.