Package java.util.regex

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


    Pattern WIKI_LINK_PATTERN = Pattern.compile("\\[\\[[^\\]]*Image:[^\\]]*\\]\\]");
    Matcher m = WIKI_LINK_PATTERN.matcher(content);
    List links = new ArrayList();
 
    while(m.find()) {
      String link = content.substring(m.start(), m.end());
      if (!link.endsWith("|right]]") && !link.endsWith("|left]]") && !link.endsWith("|center]]") )  {
        testOut("ImageTag to be replaced: "+link);
        links.add(link);
      }
    }
View Full Code Here


    Matcher m = WIKI_LINK_PATTERN.matcher(content);
 
    List links = new ArrayList();
 
    while(m.find()) {
      String link = content.substring(m.start(), m.end());
      if (!link.startsWith("[[Image:") && !link.startsWith("[[Media:") && (link.indexOf('"') != -1) ) {
        testOut("Migrate DoubleQuote in: "+link);
        // no image and link with doubleQuote
        // check for '|' => [[link|text]] extract link
        if (link.indexOf('|') != -1) {
View Full Code Here

    Matcher m = WIKI_LINK_PATTERN.matcher(content);
 
    List links = new ArrayList();
 
    while(m.find()) {
      String link = content.substring(m.start(), m.end());
      if (!link.startsWith("[[Image:") && !link.startsWith("[[Media:") && (link.indexOf("?") != -1) ) {
        testOut("Migrate Questionmark in: "+link);
        // no image and link with doubleQuote
        // check for '|' => [[link|text]] extract link
        if (link.indexOf('|') != -1) {
View Full Code Here

    if (replacements.length < intGroupCount)
      throw new JobSchedulerException("replacements missing: " + replacements.length + " replacement(s) defined but " + intGroupCount + " groups found");

    // no groups, exchange the whole string
    if (intGroupCount == 0) {
      result = pstrSourceString.substring(0, m.start()) + replacements[0] + pstrSourceString.substring(m.end());
    }
    else {
      int index = 0;
      // m.matches();
View Full Code Here

    else {
      int index = 0;
      // m.matches();

      for (int i = 1; i <= intGroupCount; i++) {
        int intStart = m.start(i);
        if (intStart >= 0) {
          String strRepl = replacements[i - 1].trim();
          if (strRepl.length() > 0) {
            if (strRepl.contains("\\") == true) {
              strRepl = strRepl.replaceAll("\\\\-", "");
View Full Code Here

          String translation;
         
          try {
            Matcher matcher = pattern.matcher(key);
            if(matcher.find()) {
              String pos = key.substring(matcher.start(), matcher.end());
              if(matcher.find()) {
                String pos2 = key.substring(matcher.start(), matcher.end());
                key = key.replace(pos + ".", "").replace(pos2 + ".", "");
                translation = translator.translate(key, new String[]{pos,pos2});
              }
View Full Code Here

          try {
            Matcher matcher = pattern.matcher(key);
            if(matcher.find()) {
              String pos = key.substring(matcher.start(), matcher.end());
              if(matcher.find()) {
                String pos2 = key.substring(matcher.start(), matcher.end());
                key = key.replace(pos + ".", "").replace(pos2 + ".", "");
                translation = translator.translate(key, new String[]{pos,pos2});
              }
              else {
                key = key.replace(pos + ".", "");
View Full Code Here

            Pattern pattern = Pattern.compile(searchText, flags);
            Matcher matcher = pattern.matcher(content);

            if (!backward) {
                if (matcher.find()) {
                    index = matcher.start();
                    foundLen = matcher.end() - index;
                }
            } else {
                while (matcher.find()) {
                    index = matcher.start();
View Full Code Here

                    index = matcher.start();
                    foundLen = matcher.end() - index;
                }
            } else {
                while (matcher.find()) {
                    index = matcher.start();
                    foundLen = matcher.end() - index;
                }
            }
        } else {
            index = backward ? content.lastIndexOf(searchText) : content.indexOf(searchText);
View Full Code Here

        Pattern pattern = Pattern.compile("\\d", Pattern.DOTALL|Pattern.UNICODE_CASE);
        Matcher matcher = pattern.matcher(s);

        boolean found = matcher.find();
        if (found) {
            System.out.println(matcher.start() + ", " + matcher.end());
        }

    }

    protected void onOk() {
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.