Package java.util.regex

Examples of java.util.regex.Pattern$GroupCurly


 
  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

        // and mark the result as not valid
        if(name.indexOf(textFilters[j]) == -1) {
         
            // double check against reg-expr if exists
         
          Pattern p = textFilterPatterns[j];
         
          if ( p == null  || !p.matcher( name ).find()){
         
            valid = false;
         
            break;
          }
        }
      }
     
      //if invalid after name check, let's get to the next result
      if(!valid) {
        continue;
      }
     
      for(int j = 0 ; j < excludeTextFilters.length ; j++) {
       
        //If one of the text filters do not match, let's not keep testing the others
        // and mark the result as not valid
        if(name.indexOf(excludeTextFilters[j]) != -1) {
          valid = false;
          break;
        }else{
          Pattern p = excludeTextFilterPatterns[j];
         
          if ( p != null  && p.matcher( name ).find()){
            valid = false;
            break;
          }
        }
      }
View Full Code Here

          TableCellImpl.TEXT_COMPARATOR);
      if (index < 0) {

        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

TOP

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

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.