Package java.util.regex

Examples of java.util.regex.Pattern$Pos


        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

     * @param uniqueName Unique name
     * @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

        prop.putHTML("filter", filter);
       
        // trying to compile the regular expression filter expression
        Matcher filterMatcher = null;
        try {
            final Pattern filterPattern = Pattern.compile(filter,Pattern.MULTILINE);
            filterMatcher = filterPattern.matcher("");
        } catch (final PatternSyntaxException e) {
            Log.logException(e);
        }

        int level = 0;
View Full Code Here

    this.server_port = server_port;
   
  }
 
  public ED2KServerLink(String link){
    Pattern s;
   
    Matcher m;
   
    s = Pattern.compile("ed2k:\\/\\/\\|server\\|([0-9]{1,3}+.[0-9]{1,3}+.[0-9]{1,3}+.[0-9]{1,3}+)\\|([0-65535]*)\\|\\/");
   
    m = s.matcher(link);
   
    if (m.matches()) {
      server_address = m.group(1);
      server_port = Integer.valueOf(m.group(2)).intValue();
    }
View Full Code Here

      server_port = Integer.valueOf(m.group(2)).intValue();
    }
  }
 
  public static boolean isValidLink(String link) {
    Pattern s;
   
    Matcher m;
   
    s = Pattern.compile("ed2k:\\/\\/\\|server\\|([0-9]{1,3}+.[0-9]{1,3}+.[0-9]{1,3}+.[0-9]{1,3}+)\\|([0-65535]*)\\|\\/");
   
    m = s.matcher(link);
   
    return m.matches();
  }
View Full Code Here

    return m.matches();
  }
 
  public static List<ED2KServerLink> extractLinks(String rawData) {
   
    Pattern s = Pattern.compile("ed2k:\\/\\/\\|server\\|([0-9]{1,3}+.[0-9]{1,3}+.[0-9]{1,3}+.[0-9]{1,3}+)\\|([0-65535]*)\\|\\/");
   
    Matcher m = s.matcher(rawData);
   
    List<ED2KServerLink> links = new LinkedList<ED2KServerLink>();
   
    while(m.find()) {
     
View Full Code Here

TOP

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

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.