I'm having a slight problem with regex I'm trying to use on my JTextArea
. What I'm trying to do it write a regex that will ignore any ordered lists and print the text area contents to the console. The lists are structured with the following conventions:
So far this is the code I'm using:
String content = txt.getText();
String removeOrderdList = content.replaceAll("^(\\d+).[ \t]+", "");
It works great on the first line of the text area contents but not on the other lines. I could remove the "^" but this will effect normal lines that have sentences
Use this
String content = txt.getText();
String removeOrderdList = content.replaceAll("(?m)^\\d+\.[ \t]+", "");