Package java.util.regex

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


        // TIME
        if (modelClass == java.sql.Time.class) {
            // 00:00:00
            Pattern pattern = Pattern.compile("'" + timeRegex + "'");
            return pattern.matcher(defaultValue).matches();
        }

        // NUMBER
        if (Number.class.isAssignableFrom(modelClass)) {
            // strip single quotes
View Full Code Here


    IOUtilities.pipeStreams(stream, bytes);

    String version = bytes.toString();

    Pattern p = Pattern.compile("Version:.*git(\\d{8}).*");
    Matcher match = p.matcher(version);

    if (match.find()) {
      if (Integer.parseInt(match.group(1)) >= WEBIF_MINIMUM_VERSION) {
        return true;
      }
View Full Code Here

        Pattern pattern = Pattern.compile("<tr><td>(\\d+):(\\d+)</td><td>(.*?)</td><td>(.*?)</td><td>(.*?)</td></tr>");

        String line = reader.readLine();
        while (line != null) {

            matcher = pattern.matcher(line);
            if (matcher.find()) {
                // System.out.println("h: "+matcher.group(1)+"; m: "+matcher.group(2)+"; title: "+matcher.group(3)+"; short: "+matcher.group(4)+"; desc: "+matcher.group(5));
                int h = Integer.parseInt(matcher.group(1));
                int m = Integer.parseInt(matcher.group(2));
                String title = matcher.group(3);
View Full Code Here

                    String attrName = ((Attribute) i.next()).getName();

                    if (attrName != null) {
                        for (Iterator j = a.iterator(); j.hasNext();) {
                            Pattern p = (Pattern) j.next();
                            if (p.matcher(attrName).matches()) {
                                j.remove();
                            }
                        }

                        if (a.isEmpty()) {
View Full Code Here

      if (!this.failSilently) throw new IllegalArgumentException(
          "Block '" + blockName + "' not found." +
              " Matches " + locateBlock(blockName));
    }
    Pattern pattern = Pattern.compile("\\{([\\w\\.]+)\\}");
    Matcher matcher = pattern.matcher(copy);
    pattern = Pattern.compile("_BLOCK_\\.(.+)");
    for (Matcher matcher2; matcher.find();)
    {
      String match = matcher.group(1);
      matcher2 = pattern.matcher(match);
View Full Code Here

    Matcher matcher = pattern.matcher(copy);
    pattern = Pattern.compile("_BLOCK_\\.(.+)");
    for (Matcher matcher2; matcher.find();)
    {
      String match = matcher.group(1);
      matcher2 = pattern.matcher(match);
      if (matcher2.find())
      {
        if (parsedBlocks.containsKey(matcher2.group(1)))
        {
          copy = copy.replaceFirst("\\{"+match+"\\}", escape(
View Full Code Here

      this.implicitMain  = true; // affects parse(block) and out()
      fileText = "<!-- BEGIN: main -->" + fileText + "<!-- END: main -->";
    }
    // END: implicit main
    Pattern pattern = Pattern.compile("<!--\\s*(BEGIN|END)\\s*:\\s*(\\w+)\\s*-->(.*?)(?=(?:<!--\\s*(?:BEGIN|END)\\s*:\\s*\\w+\\s*-->)|(?:\\s*$))", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
    Matcher matcher = pattern.matcher(fileText);
    ArrayList blockNames = new ArrayList();
    String parentName = "";
    int lastlength = 0; // used in newline trimming to see if one block immediately follows the previous
    while (matcher.find())
    {
View Full Code Here

    rePattern.insert(0, '^');
    rePattern.append('$');

    try {
            Pattern patternRegex = Pattern.compile(rePattern.toString(), Pattern.DOTALL);
            Matcher matcher = patternRegex.matcher(search);
            return matcher.matches();
    } catch(PatternSyntaxException e) {
            throw new ExpressionEvaluationException(e, "ERR.015.006.0014", QueryPlugin.Util.getString("ERR.015.006.0014", new Object[]{pattern, e.getMessage()})); //$NON-NLS-1$ //$NON-NLS-2$
    }
  }
View Full Code Here

public class SystemPropertiesHandler {
    public static Map<String, String> getSystemProperties(String[] arguments) {
        Map<String, String> propertyMap = new HashMap<String, String>();
        Pattern pattern = Pattern.compile("-D([^=]*)=?(.*)");
        for (String argument : arguments) {
            Matcher matcher = pattern.matcher(argument);
            if (matcher.find()) {
                String key = matcher.group(1);
                String value = matcher.group(2);
                if (key.length() > 0) {
                    propertyMap.put(key, value);
View Full Code Here

            throw new RuntimeException("Error when loading properties file=" + propertiesFile, e);
        }

        Pattern pattern = Pattern.compile("systemProp\\.(.*)");
        for (Object argument : properties.keySet()) {
            Matcher matcher = pattern.matcher(argument.toString());
            if (matcher.find()) {
                String key = matcher.group(1);
                if (key.length() > 0) {
                    propertyMap.put(key, properties.get(argument).toString());
                }
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.