Examples of Regex


Examples of org.joni.Regex

    @JRubyMethod(name = "scan", reads = BACKREF, writes = BACKREF, compat = RUBY1_9)
    public IRubyObject scan19(ThreadContext context, IRubyObject arg, Block block) {
        Ruby runtime = context.getRuntime();
        Encoding enc = value.getEncoding();
        final Regex pattern, prepared;
        final RubyRegexp regexp;
        final int tuFlags;
        if (arg instanceof RubyRegexp) {
            regexp = (RubyRegexp)arg;
            tuFlags = regexp.flags;
View Full Code Here

Examples of org.moxie.Regex

    doc.nomarkdowns.add(nomd);
    return nomd;
  }

  public Regex createRegex() {
    Regex regex = new Regex();
    doc.regexes.add(regex);
    return regex;
  }
View Full Code Here

Examples of org.openrdf.query.algebra.Regex

  {
    ValueExpr expr = (ValueExpr)node.getValueExpr().jjtAccept(this, null);
    String pattern = (String)node.getPattern().jjtAccept(this, null);
    boolean caseSensitive = !node.ignoreCase();

    return new Regex(expr, pattern, caseSensitive);
  }
View Full Code Here

Examples of org.openrdf.query.algebra.Regex

    ValueExpr pattern = (ValueExpr)node.jjtGetChild(1).jjtAccept(this, null);
    ValueExpr flags = null;
    if (node.jjtGetNumChildren() > 2) {
      flags = (ValueExpr)node.jjtGetChild(2).jjtAccept(this, null);
    }
    return new Regex(arg, pattern, flags);
  }
View Full Code Here

Examples of pat.Regex

    return _getClassFile(Package.getPackageName(sFullClassName_),                  Package.getClassName(sFullClassName_))}
  private String _getRcsVersion() {
    String sClassFileContent = _getClassFile(_sMainClass);
    if (sClassFileContent == null) {
      return (String)null;    }
    Regex pRegex = new Regex("\\$Header: [^ ]*\\.java[^ ]* (\\d+\\.\\d+) ");
    pRegex.search(sClassFileContent);
    String sVersion = pRegex.substring(0);
    return sVersion;  }
View Full Code Here

Examples of pt.opensoft.text.Regex

  }

  public abstract List getNames ();

  public List getNames (String pattern) {
    Regex regex = new Regex(pattern);
    List names = getNames();
    List result = new ArrayList(names.size());
    for (Iterator iterator = names.iterator(); iterator.hasNext(); ) {
      String name = (String) iterator.next();
      if (regex.contains(name)) result.add(name);
    }
    return result;
  }
View Full Code Here

Examples of pt.opensoft.text.Regex

      throw new BuildException("MUST DEFINE 'currentVersion' ATTRIBUTE");
    }

    try {
      DateTime now = new DateTime();
      Regex version = new Regex(VERSION_PATTERN);
      Regex geek = new Regex(TECNICAL_PATTERN);

      BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(
        this.inputFilePath), "ISO-8859-1"));
      PrintStream writer = new PrintStream(new FileOutputStream(this.outputFilePath), false, "ISO-8859-1");

      writer.println("[Vers�o " + this.currentVersion + " (" + now.formatDate() + ")]");
      writer.println();

      boolean fullFile = this.lastVersion.equals(this.currentVersion);

      String line = reader.readLine();
      while (line != null) { // EOF
        if (!fullFile && version.matches(line) && (line.indexOf(this.lastVersion) != -1)) {
          break;
        } else if (version.matches(line) || geek.matches(line)) {
          line = reader.readLine();
          continue;
        } else {
          writer.println(line);
          line = reader.readLine();
View Full Code Here

Examples of pt.opensoft.text.Regex

  public static void createTable (Hashtable types, Hashtable tables, String ddl) {


    try {
            Regex regex = new Regex("CREATE\\s+TABLE\\s+(\\S+)\\s*\\((.*)\\)\\s*$",Regex.CASE_INSENSITIVE_MASK);

            if (regex.contains(ddl)) {

        String tableName = regex.getGroup(1);
        String fieldsDDL = regex.getGroup(2);

        Hashtable table = new Hashtable();

        table.put("name", tableName);
        table.put("className", tableName + "Table");
View Full Code Here

Examples of pt.opensoft.text.Regex

    Hashtable fields = new Hashtable();
    int max = 0;

    try {

            Regex regex = new Regex("(\\s+\\S+\\(\\d+)\\,(\\d+\\)\\s+)");

            fieldsDDL = regex.substitute(fieldsDDL, "$1;$2", Regex.SUBSTITUTE_ALL);

            Regex fieldDDLRegex1 = new Regex("^\\s*(\\S+)\\s+");

            Regex fieldDDLRegex2 = new Regex("(.*)\\s+NOT\\s+NULL", Regex.CASE_INSENSITIVE_MASK);
            Regex fieldDDLRegex3 = new Regex("(.*)\\s+NULL", Regex.CASE_INSENSITIVE_MASK);

            // fieldDDLRegex4 is dynamic

            Regex fieldDDLRegex5 = new Regex("(.*)\\((\\d+)\\)");
            Regex fieldDDLRegex6 = new Regex("(.*)\\((\\d+)\\;(\\d+)\\)");

      List list = new Regex(",").split(fieldsDDL);

      for (Iterator it = list.iterator(); it.hasNext(); ) {
        String fieldDDL = (String) it.next();

        if (! fieldDDLRegex1.contains(fieldDDL)) {
          throw new Exception("createFields::incorrect syntax::missing column name::"+fieldDDL);
                }

        String fieldName = fieldDDLRegex1.getGroup(1);
        String fieldId = getFieldId(fieldName);

        if (fieldId.length() > max) max = fieldId.length();

        String fieldNulls = "NULL";

        if (fieldDDLRegex2.contains(fieldDDL)) {
          fieldDDL = fieldDDLRegex2.getGroup(1);
          fieldNulls = "NOT NULL";
        } else if (fieldDDLRegex3.contains(fieldDDL)) {
          fieldDDL = fieldDDLRegex3.getGroup(1);
        }

        String fieldSize = "-1";

        String fieldType = "integer";

                Regex fieldDDLRegex4 = new Regex(fieldName+"\\s+(.*)\\s*$");

                if (fieldDDLRegex4.contains(fieldDDL)) {
          fieldType = fieldDDLRegex4.getGroup(1).trim();
        }

        if (fieldDDLRegex5.contains(fieldType)) {
          fieldType = fieldDDLRegex5.getGroup(1);
          fieldSize = fieldDDLRegex5.getGroup(2);
View Full Code Here

Examples of pt.opensoft.text.Regex

  public static void createView (Hashtable tables, Hashtable views, String ddl) {
        try {
            String viewName;

            Regex viewDDLRegex1 = new Regex("CREATE\\s+VIEW\\s+(\\S+)", Regex.CASE_INSENSITIVE_MASK);

      if (!viewDDLRegex1.contains(ddl)) {
        throw new Exception("undefined view name in ddl: "+ddl);
            }

      viewName = viewDDLRegex1.getGroup(1);

      if (debug >= 1) System.out.println(lineSeparator+"  Creating View '"+viewName+"'...");

      Hashtable view = new Hashtable();

      views.put(viewName, view);

      view.put("name", viewName);
      view.put("className", viewName + "ViewTable");
      view.put("type", "ViewTable");

      if (packageName == null)
        view.put("fullClassName", viewName + "ViewTable");
      else
        view.put("fullClassName", packageName + "." + viewName + "ViewTable");

      String columnNames = null;

            Regex viewDDLRegex2 = new Regex("CREATE\\s+VIEW\\s+\\S+\\s*\\((.*)\\)", Regex.CASE_INSENSITIVE_MASK);

      if (viewDDLRegex2.contains(ddl)){
        columnNames = viewDDLRegex2.getGroup(1);
            }

      if (debug >= 2) System.out.println(lineSeparator+"    Columns '"+columnNames+"'");

      String selectFields;

            Regex viewDDLRegex3 = new Regex("SELECT\\s+DISTINCT\\s+(.*)\\s+FROM", Regex.CASE_INSENSITIVE_MASK);
            Regex viewDDLRegex4 = new Regex("SELECT\\s+(.*)\\s+FROM", Regex.CASE_INSENSITIVE_MASK);

      if (viewDDLRegex3.contains(ddl)) {
        selectFields = viewDDLRegex3.getGroup(1);
            } else if (viewDDLRegex4.contains(ddl)) {
        selectFields = viewDDLRegex4.getGroup(1);
            } else {
        throw new Exception("no select columns in create view ddl: "+ddl);
            }

      if (debug >= 2) System.out.println(lineSeparator+"    Select Fields '"+selectFields+"'");

      String tableNames;

            Regex viewDDLRegex5 = new Regex("FROM\\s+(.*)\\s+WHERE", Regex.CASE_INSENSITIVE_MASK);
            Regex viewDDLRegex6 = new Regex("FROM\\s+(.*)", Regex.CASE_INSENSITIVE_MASK);

      if (viewDDLRegex5.contains(ddl)) {
        tableNames = viewDDLRegex5.getGroup(1);
            } else if (viewDDLRegex6.contains(ddl)) {
        tableNames = viewDDLRegex6.getGroup(1);
            } else {
        throw new Exception("no tables in create view ddl: "+ddl);
            }

            Regex viewDDLRegex7 = new Regex(",", Regex.CASE_INSENSITIVE_MASK);
      List vTableNames = viewDDLRegex7.split(tableNames);

      Vector vTables = new Vector();

      for (Iterator it = vTableNames.iterator(); it.hasNext(); ) {
        String tableName = (String) it.next();
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.