package hex.grep;

import org.junit.*;
import water.DKV;
import water.Key;
import water.TestUtil;
import water.fvec.Frame;
import water.fvec.NFSFileVec;
import water.fvec.Vec;

import java.io.File;

public class GrepTest extends TestUtil {
  @BeforeClass() public static void setup() { stall_till_cloudsize(1); }
  
  @Test public void testIris() {
    GrepModel kmm = null;
    Frame fr = null;
    try {
      //String regex = "Iris-versicolor";
      //File f = new File("smalldata/iris/iris_wheader.csv");
      String regex = "(?:(\\w)\\1){5}";
      File f = new File("bigdata/laptop/text8.txt");
      NFSFileVec nfs = NFSFileVec.make(f);
      DKV.put(fr = new Frame(Key.make(), new String[]{"text"}, new Vec[]{nfs}));

      GrepModel.GrepParameters parms = new GrepModel.GrepParameters();
      parms._train = fr._key;
      parms._regex = regex;

      Grep job = new Grep(parms).trainModel();
      kmm = job.get();
      job.remove();

    } finally {
      if( fr  != null ) fr .remove();
      if( kmm != null ) kmm.delete();
    }
  }
}

@@ -405,18 +405,16 @@
 %7B%0A      
-//
 String r
@@ -449,10 +449,8 @@
     
-//
 File
@@ -501,24 +501,26 @@
 sv%22);%0A      
+//
 String regex
@@ -539,32 +539,34 @@
 %5C%5C1)%7B5%7D%22;%0A      
+//
 File f = new Fil

Tweak GrepTest