code: public static List<StartEndPair> scan(String input, String splitStart,
  			String splitEnd, boolean useEscaping) {
  		List<StartEndPair> result = new ArrayList<StartEndPair>();
  		int fromIndex = 0;
  		while (true) {
  			int exprStart = input.indexOf(splitStart, fromIndex);
  			if (exprStart == -1) {
  				break;
  			}
  			if (useEscaping && Util.isEscaped(input, exprStart)) {
  				fromIndex = exprStart + splitStart.length();
  				continue;
  			}
  
  			exprStart += splitStart.length();
  			int exprEnd = input.indexOf(splitEnd, exprStart);
  			if (exprEnd == -1) {
  				break;
  			}
  			while (useEscaping && Util.isEscaped(input, exprEnd)) {
  				exprEnd = input.indexOf(splitEnd, exprEnd + splitEnd.length());
  			}
  
  			fromIndex = exprEnd + splitEnd.length();
  
  			StartEndPair startEndPair = new StartEndPair(exprStart, exprEnd);
  			result.add(startEndPair);
  		}
  		return result;
  	}
docs: Scans the input and spits out begin/end pairs telling you where
  expressions can be found.
  
  @param input
  the input
  @return the begin/end pairs telling you where expressions can be found