Package java.util.regex

Examples of java.util.regex.Matcher.find()


    if(matcher.find()) {
      //We have a date with letters, could be age-based or time based (with a literal month)
     
      //Try to determine if it is age-based or time-based
      matcher = isAgeBasedPattern.matcher(s);
      if(matcher.find()) {
        //Age Based date
       
        matcher = todayPattern.matcher(s);
        if(matcher.find()) {
          //Nothing to do for today as we base our initial date on the current one
View Full Code Here


      matcher = isAgeBasedPattern.matcher(s);
      if(matcher.find()) {
        //Age Based date
       
        matcher = todayPattern.matcher(s);
        if(matcher.find()) {
          //Nothing to do for today as we base our initial date on the current one
        } else {
          matcher = yesterdayPattern.matcher(s);
          if(matcher.find()) {
            calendar.add(Calendar.DATE, -1);
View Full Code Here

        matcher = todayPattern.matcher(s);
        if(matcher.find()) {
          //Nothing to do for today as we base our initial date on the current one
        } else {
          matcher = yesterdayPattern.matcher(s);
          if(matcher.find()) {
            calendar.add(Calendar.DATE, -1);
          } else {
            //We're in the real "ago" case, let's remove " ago" if it's there
            s = s.replaceAll("ago","").trim();
            matcher = agoSpacerPattern.matcher(s);
View Full Code Here

            s = s.replaceAll("ago","").trim();
            matcher = agoSpacerPattern.matcher(s);
            s = matcher.replaceAll("$1 $2");
            matcher = agoTimeRangePattern.matcher(s);
            boolean seenHoursAsLowerCaseH = false;
            while(matcher.find()) {
              String unit = matcher.group(2);
             
              if(unit.equals("h")) {
                seenHoursAsLowerCaseH = true;
              }
View Full Code Here

       
      } else {
        //Time based date
        //System.out.println("DL : " + s);
        matcher = timeBasedDateWithLettersPattern.matcher(s);
        if(matcher.find()) {
          int day = Integer.parseInt(matcher.group(1));
          calendar.set(Calendar.DAY_OF_MONTH,day);
         
          String monthStr = " " + matcher.group(2).toLowerCase();
          int month = -1;
View Full Code Here

          //System.out.println(input + " > " + calendar.getTime() + "( " + calendar.getTimeZone() + " )");
         
        } else {
          matcher = timeBasedDateWithLettersPatternMonthFirst.matcher(s);
          if(matcher.find()) {
            int day = Integer.parseInt(matcher.group(2));
            calendar.set(Calendar.DAY_OF_MONTH,day);
           
            String monthStr = " " + matcher.group(1).toLowerCase();
            int month = -1;
View Full Code Here

    } else {
      //We have a date with only numbers
      //System.out.println("DN : " + s );//+ "(" + input + ")");
      //Let's assume a default order of m/d and switch if it doesn't make sense
      matcher = numbersOnlyDatePattern.matcher(s);
      if(matcher.find()) {
        try {
       
          String g1 = matcher.group(1);
          String g2 = matcher.group(2);
          String g3 = matcher.group(3);
View Full Code Here

      //System.out.println(input + " > " + calendar.getTime());
    }
   
    //Extract the time information
    matcher = getTimeComponent.matcher(input);
    if(matcher.find()) {
      try {
        int hours = Integer.parseInt(matcher.group(1));
       
        int minutes = Integer.parseInt(matcher.group(2));
        calendar.set(Calendar.MINUTE,minutes);
View Full Code Here

    {
      return;
    }

    Matcher url_matcher = URL.matcher(fullMessage.getTrailing());
    if (url_matcher.find())
    {
      String url = url_matcher.group(1).trim();
      try
      {
        URL url_parsed = new URL(url);
View Full Code Here

        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
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.