I have a file that needs to be read using regular expressions. The string can basically include anything (upper case, lower case, spaces, symbols, etc) so long as the line is no more than 60 characters. The method I tried works for most strings in the file, however, I need to be able to allow quotation marks as well, which is where I’m getting stuck. Here’s what I’ve tried so far.
else if (data.matches("[A-Za-z0-9 ,.?!%&()@$-_:;\\\"]+$")
&& !label.equals("") && prompt.equals("") && data.length() <= 60)
{
prompt = data;
}
It reads everything else in fine, except the following string
Yes, but an error is displayed, “Fuser out.”
Don’t ask about the spelling, that was what was in the sample file I was given.
Thanks for any help, hopefully I’ll get a response before I leave the laundromat, since I’m on Long Island and have no power or internet at home thanks to the hurricane.
Add
\"in your regular expression e.g. below:where
\"is used, it will use"as a literal to match.