Package java.util.regex

Examples of java.util.regex.Pattern$Category


            }
        } catch (IOException e) {
            throw new RuntimeException("Error when loading properties file=" + propertiesFile, e);
        }

        Pattern pattern = Pattern.compile("systemProp\\.(.*)");
        for (Object argument : properties.keySet()) {
            Matcher matcher = pattern.matcher(argument.toString());
            if (matcher.find()) {
                String key = matcher.group(1);
                if (key.length() > 0) {
                    propertyMap.put(key, properties.get(argument).toString());
                }
View Full Code Here


      if ( !type.endsWith("*")){
       
        type = type + ".*";
      }
     
      Pattern pattern = Pattern.compile( type );
           
      for (int i=0;i<stats_names.size();i++){
       
        String  s = (String)stats_names.get(i);
       
        if ( pattern.matcher( s ).matches()){
         
          expanded.add( s );
        }
      }
     
      Iterator provider_it = providers.iterator();
     
      while( provider_it.hasNext()){
       
        Object[]  provider_entry = (Object[])provider_it.next();
       
        Set provider_types = (Set)provider_entry[0];
       
        Iterator pt_it = provider_types.iterator();
       
        while( pt_it.hasNext()){
         
          String  s = (String)pt_it.next();
         
          if ( pattern.matcher( s ).matches()){
           
            expanded.add( s );
          }
        }
      }
View Full Code Here

 
  private InetAddress[] calcBindAddresses(final String addressString, boolean enforceBind)
  {
    ArrayList<InetAddress> addrs = new ArrayList<InetAddress>();
   
    Pattern addressSplitter = Pattern.compile(";");
    Pattern interfaceSplitter = Pattern.compile("[\\]\\[]");
   
    String[] tokens = addressSplitter.split(addressString);

addressLoop:
    for(int i=0;i<tokens.length;i++)
    {
      String currentAddress = tokens[i];
     
      currentAddress = currentAddress.trim();
     
      if ( currentAddress.length() == 0 ){
        continue;
      }
     
      InetAddress parsedAddress = null;
     
      try
      { // literal ipv4 or ipv6 address
        if(currentAddress.indexOf('.') != -1 || currentAddress.indexOf(':') != -1)
          parsedAddress = InetAddress.getByName(currentAddress);
      } catch (Exception e)
      { // ignore, could be an interface name containing a ':'
      }
     
      if(parsedAddress != null)
      {
        try
        {
          // allow wildcard address as 1st address, otherwise only interface addresses
          if((!parsedAddress.isAnyLocalAddress() || addrs.size() > 0) && NetworkInterface.getByInetAddress(parsedAddress) == null)
            continue;
        } catch (SocketException e)
        {
          Debug.printStackTrace(e);
          continue;
        }
        addrs.add(parsedAddress);
        continue;
      }
       
      // interface name
      String[] ifaces = interfaceSplitter.split(currentAddress);

      NetworkInterface netInterface = null;
      try
      {
        netInterface = NetworkInterface.getByName(ifaces[0]);
View Full Code Here

        }
        if ((stringField != null) & (req.regexp().length() > 0))
        {
            try
            {
                Pattern pattern = Pattern.compile(req.regexp());
                Matcher matcher = pattern.matcher(stringField);
                if (!matcher.matches())
                    errors.rejectValue(field.getName(), errorCodes[1], req.regexp());
            }
            catch (Exception ex)
            {
View Full Code Here

   
    String  host_address = address.getHostAddress();
   
    for (int i=0;i<lan_subnets.size();i++){
     
      Pattern  p = (Pattern)lan_subnets.get(i);
     
      if ( p.matcher( host_address ).matches()){
               
        return( true );
      }
    }
   
View Full Code Here

       
        str += c;
      }
    }
   
    Pattern pattern = Pattern.compile( str );
   
    for (int i=0;i<lan_subnets.size();i++){
     
      if ( pattern.pattern().equals(((Pattern)lan_subnets.get(i)).pattern())){
       
        return( false );
      }
    }
   
View Full Code Here

        return true;
    }

    public static boolean matchPattern(String fileName, String regex) {
        if (regex == null) return true;
        Pattern p = Pattern.compile(regex);
        Matcher m = p.matcher(fileName);
        return m.matches();
    }
View Full Code Here

        new UnflaggedOption( "h", JSAP.INTEGER_PARSER, JSAP.REQUIRED, "The maximum height to scan." )
    });

    JSAPResult jsapResult = jsap.parse( arg );
    if ( jsap.messagePrinted() ) return;
    Pattern pattern = Pattern.compile( "\t" );
    Matcher matcher = pattern.matcher( "" );
   
    final int h = jsapResult.getInt( "h" );
    final String basename = jsapResult.getString( "basename" );
    final PrintStream printStream[] = new PrintStream[ h + 1 ];
    for( int i = 0; i <= h; i++ ) printStream[ i ] = new PrintStream( new FastBufferedOutputStream( new FileOutputStream( basename + "-" + i + DiskBasedIndex.STATS_EXTENSION ) ) );
View Full Code Here

        return;
      }
         
      try
      {
        Pattern log_pattern = Pattern.compile(detect_matcher.group(1));
        Matcher log_matcher = log_pattern.matcher(last_log);
        String result = null;
        if ("g".equals(detect_matcher.group(3)))
        {
          result = log_matcher.replaceAll(detect_matcher.group(2));
        }
View Full Code Here

        }
        if ((stringField != null) & (req.regexp().length() > 0))
        {
            try
            {
                Pattern pattern = Pattern.compile(req.regexp());
                Matcher matcher = pattern.matcher(stringField);
                if (!matcher.matches())
                    errors.rejectValue(field.getName(), errorCodes[1], req.regexp());
            }
            catch (Exception ex)
            {
View Full Code Here

TOP

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

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.