Here you can find the source of betweenNonGreedy(String string, String start, String end)
public static String betweenNonGreedy(String string, String start, String end)
//package com.java2s; //License from project: Apache License public class Main { public static String betweenNonGreedy(String string, String start, String end) { int startIndex = string.indexOf(start); int searchFrom = startIndex + start.length(); String between;/* w w w . j av a2 s . com*/ if (searchFrom == string.length()) { between = ""; } else { int endIndex = string.indexOf(end, searchFrom); if (endIndex != -1) { int startPoint = searchFrom; if (startPoint > endIndex) { between = null; } else { between = string.substring(searchFrom, endIndex); } } else { between = null; } } return between; } }