import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main {
public static void main(String[] argv) throws Exception {
CharSequence inputStr = "a\rb";
inputStr = "a\r\nb";
inputStr = "a\nb";
String patternStr = "^(.*)$";
Pattern pattern = Pattern.compile(patternStr, Pattern.MULTILINE);
Matcher matcher = pattern.matcher(inputStr);
while (matcher.find()) {
String lineWithTerminator = matcher.group(0);
String lineWithoutTerminator = matcher.group(1);
}
}
}
|