I am trying to take in a line from a text file and remove all punctuation, such as commas, periods, single quotes, double quotes, etc. and set the string to be lowercase. The code that I am using is:
inputLine.replaceAll("[^a-zA-Z'\\s]", "").toLowerCase();
Which to my understanding would do this, however it isn't. It also doesn't set words to lowercase either. So I included another line to specifically remove periods and commas:
inputLine.replaceAll("\\.", "");
and then to split each word into a String array:
String[] strings = inputLine.split(" ");
However, I am still ending up with words such as sets, There properties:[1]. Does anyone know why this is happening, or could you provide a solution to this? I have not done much regex work before, so this is all very new to me.
inputLinecontains and what output you're getting.