public static int[] indexOfRegion(String string,String leftBoundary,String rightBoundary,int offset){
  int ndx=offset;
  int[] res=new int[4];
  ndx=string.indexOf(leftBoundary,ndx);
  if (ndx == -1) {
    return null;
  }
  res[0]=ndx;
  ndx+=leftBoundary.length();
  res[1]=ndx;
  ndx=string.indexOf(rightBoundary,ndx);
  if (ndx == -1) {
    return null;
  }
  res[2]=ndx;
  res[3]=ndx + rightBoundary.length();
  return res;
}

public static int [ ] indexOfRegion ( String string , String leftBoundary , String rightBoundary , int offset ) { int ndx = offset ; int [ ] res = new int [ 4 ] ; ndx = string . indexOf ( leftBoundary , ndx ) ; if ( ndx == - 1 ) { return null ; } res [ 0 ] = ndx ; ndx += leftBoundary . length ( ) ; res [ 1 ] = ndx ; ndx = string . indexOf ( rightBoundary , ndx ) ; if ( ndx == - 1 ) { return null ; } res [ 2 ] = ndx ; res [ 3 ] = ndx + rightBoundary . length ( ) ; return res ; }
returns indexes of the first region without escaping character .
