I am trying to validate and restrict email address format when getting output from a text file, using java. I am opening the file this way at the moment.
inputStream = new BufferedReader(new FileReader(filename));
while ((fileLine = inputStream.readLine()) != null) {
System.out.println(fileLine);}}
I tried "if (filename.matches("^[A-Za-z0-9+_.-]+@(.+)$"))
"
But is am pretty sure that is just checking the file's actual name.
If someone has a moment, could you please guide me on how to do this properly?
Thank you all!