Package java.util.regex

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


    String pre = "\\$\\{";
    String post = "\\}";
    String regex = pre+"(.*?)"+post;
    Pattern pattern = Pattern.compile(regex);

    Matcher matcher = pattern.matcher(value);

    while (matcher.find()) {
      String sysKey = matcher.group(1);
      String p = pre + sysKey + post;
      String v = sysKey.equalsIgnoreCase("user.appdata") ? System.getenv("appdata") : System.getProperty(sysKey,"UNKNOWN");
View Full Code Here


          }

          updateItems.add(curItem);
        }
        else {
          matcher=keyValuePattern.matcher(line);

          if (matcher.find()) { // new plugin
            String value = matcher.group(2);
            value = value.replaceAll("\\\\", ""); // fix wrong HTML encoding in plugin descriptions
View Full Code Here

              .getIterator(HTML.Tag.CONTENT); it.isValid(); it.next()) {
            try {
              String fragment = document.getText(it.getStartOffset(), it
                  .getEndOffset()
                  - it.getStartOffset());
              Matcher matcher = pattern.matcher(fragment);
              while (matcher.find()) {
                highlighter.addHighlight(it.getStartOffset() + matcher.start(),
                    it.getStartOffset() + matcher.end(), painter);
              }
            } catch (BadLocationException ex) {
View Full Code Here

        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

    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

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

        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

   
    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

          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

        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

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.