Examples of matcher()


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

        Matcher matcher = null;

        // set up the regular expression specification
        pattern = Pattern.compile(spec);
        // set up the actual event string
        matcher = pattern.matcher(eventString);

        // check if the actual string satisfies the specification
        if (matcher.find()) {
            // a match has been found, but we need to check that the whole event string
            // matches, and not just a substring
View Full Code Here

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

    Pattern p = Pattern.compile("get([A-Z]\\w+)");
   
    for (int i = 0; i < m.length; i++) {
      if (m[i].getName().equals("getClass")) continue;
      if (m[i].getParameterTypes().length > 0) continue;
      Matcher r = p.matcher(m[i].getName());
      if (r.matches()) {
        try {
          values.put(r.group(1).toLowerCase(), m[i].invoke(bean, new Object[0]));
        } catch (IllegalArgumentException e) {
          throw e;
View Full Code Here

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

    // javascript:loadOrAlert('WVOPRHRPFSCLAW7UWHCXCH7QNQIU6TWG')

    // accept raw hash of 32 base-32 chars, with garbage around it
    if (accept_magnets && guess) {
      Pattern pattern = Pattern.compile("[^a-zA-Z2-7][a-zA-Z2-7]{32}[^a-zA-Z2-7]");
      Matcher matcher = pattern.matcher(text);
      if (matcher.find()) {
        String hash = text.substring(matcher.start() + 1, matcher.start() + 33);
        return "magnet:?xt=urn:btih:" + hash;
      }
View Full Code Here

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

        String hash = text.substring(matcher.start() + 1, matcher.start() + 33);
        return "magnet:?xt=urn:btih:" + hash;
      }

      pattern = Pattern.compile("[^a-fA-F0-9][a-fA-F0-9]{40}[^a-fA-F0-9]");
      matcher = pattern.matcher(text);
      if (matcher.find()) {
        String hash = text.substring(matcher.start() + 1, matcher.start() + 41);
        // convert from HEX to raw bytes
        byte[] infohash = ByteFormatter.decodeString(hash.toUpperCase());
        // convert to BASE32
View Full Code Here

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

   
    Pattern pattern;
    Matcher matcher;

    pattern = Pattern.compile("bc://bt/([a-z0-9=\\+/]+)", Pattern.CASE_INSENSITIVE);
    matcher = pattern.matcher(text.replaceAll(" ", "+"));
    if (matcher.find()) {
      String base64 = matcher.group(1);
      byte[] decode = Base64.decode(base64);
      if (decode != null && decode.length > 0) {
        // Format is AA/<name>/<size>/<hash>/ZZ
View Full Code Here

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

          int currentIndex = ((Integer) thisIndexIterator.next()).intValue();
          String fieldValue = String.valueOf(rowData.get(currentIndex - 1));

          if (fieldValue != null) {
            Pattern pattern = Pattern.compile("[^a-zA-z_0-9 ]");
            Matcher fieldMatch = pattern.matcher(fieldValue);
            fieldValue = fieldMatch.replaceAll("");
            // fieldValue = fieldValue.replaceAll("'","");
          }

          if (fieldValue == null || fieldValue.equals("null")) {
View Full Code Here

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

        String s = bRegexSearch ? tmpSearch : "\\Q"
            + tmpSearch.replaceAll("[|;]", "\\\\E|\\\\Q") + "\\E";
        Pattern pattern = Pattern.compile(s, Pattern.CASE_INSENSITIVE);

        if (!pattern.matcher(name).find())
          bOurs = false;
      } catch (Exception e) {
        // Future: report PatternSyntaxException message to user.
      }
    }
View Full Code Here

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

        File file = new File(confList[i]);
        if (file.isFile() && file.canRead()) {
          log("  checking " + file + " for GRE_PATH");
          String fileText = FileUtil.readFileAsString(file, 16384);
          if (fileText != null) {
            Matcher matcher = pat.matcher(fileText);
            if (matcher.find()) {
              String possibleGrePath = matcher.group(1);
              if (isValidGrePath(new File(possibleGrePath))) {
                grePath = possibleGrePath;
                break;
View Full Code Here

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

   * @return
   */
  public static boolean mkdirs(File f) {
    if (Constants.isOSX) {
      Pattern pat = Pattern.compile("^(/Volumes/[^/]+)");
      Matcher matcher = pat.matcher(f.getParent());
      if (matcher.find()) {
        String sVolume = matcher.group();
        File fVolume = new File(sVolume);
        if (!fVolume.isDirectory()) {
          Logger.log(new LogEvent(LOGID, LogEvent.LT_WARNING, sVolume
View Full Code Here

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

  {
    Pattern pattern = Pattern.compile(wildcardToPattern(filter), Pattern.CASE_INSENSITIVE);
    List list = new ArrayList();
    for (Iterator iter = torrents.iterator(); iter.hasNext();) {
      DownloadManager dm = (DownloadManager) iter.next();
      if( pattern.matcher(dm.getDisplayName()).matches() )
        list.add(dm);
    }
    return list;
  }
 
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.