package gotowe.p42_tekstowe;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Odczyt5_Scanner_Slowa {

    public static void main(String[] args) {
        try(Scanner sc = new Scanner(new File("pliki/pan_tadeusz.txt"))) {
            sc.useDelimiter("[^\\p{L}\\d]+");
            while(sc.hasNext()) {
                String slowo = sc.next();
                System.out.println("[" + slowo + "]");
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
}
