java - Regex command not executing properly -
i trying take in line text file , remove punctuation, such commas, periods, single quotes, double quotes, etc. , set string lowercase. code using is:
inputline.replaceall("[^a-za-z'\\s]", "").tolowercase(); which understanding this, isn't. doesn't set words lowercase either. included line remove periods , commas:
inputline.replaceall("\\.", ""); and split each word string array:
string[] strings = inputline.split(" "); however, still ending words such sets, there properties:[1]. know why happening, or provide solution this? have not done regex work before, new me.
are reassigning inputline? remember: strings immutable!
inputline = inputline.replaceall("[^a-za-z'\\s]", "").tolowercase(); by way can use .replaceall("\\p{punct}", "") replace punctuation.
Comments
Post a Comment