public String[] split(String s){
  ArrayList v=new ArrayList();
  int pos=0;
  int len=s.length();
  while (pos < len && match(s,pos)) {
    int start=getParenStart(0);
    int newpos=getParenEnd(0);
    if (newpos == pos) {
      v.add(s.substring(pos,start + 1));
      newpos++;
    }
 else {
      v.add(s.substring(pos,start));
    }
    pos=newpos;
  }
  String remainder=s.substring(pos);
  if (remainder.length() != 0) {
    v.add(remainder);
  }
  String[] ret=new String[v.size()];
  v.toArray(ret);
  return ret;
}

public String [ ] split ( String s ) { ArrayList v = new ArrayList ( ) ; int pos = 0 ; int len = s . length ( ) ; while ( pos < len && match ( s , pos ) ) { int start = getParenStart ( 0 ) ; int newpos = getParenEnd ( 0 ) ; if ( newpos == pos ) { v . add ( s . substring ( pos , start + 1 ) ) ; newpos ++ ; } else { v . add ( s . substring ( pos , start ) ) ; } pos = newpos ; } String remainder = s . substring ( pos ) ; if ( remainder . length ( ) != 0 ) { v . add ( remainder ) ; } String [ ] ret = new String [ v . size ( ) ] ; v . toArray ( ret ) ; return ret ; }
splits a string into an array of strings on regular expression boundaries . this function works the same way as the perl function of the same name . given a regular expression of " [ ab ] + " and a string to split of " xyzzyababbayyzabbbab123 " , the result would be the array of strings " [ xyzzy , yyz , 123 ] " . < p > please note that the first string in the resulting array may be an empty string . this happens when the very first character of input string is matched by the pattern .
