Regular expressions are used in combination to remove serial numbers starting with numbers.

There will be various needs in the project, and there will also be a need to clean and clean the data, etc.

Example 1: Match the sum of numbers in the data. Or the sum of numbers, or the sum of numbers. etc.

Simply record it: the code is as follows:

/*
    * Remove the serial number
    * */
    public static void test1() throws IOException {        /* String str = "5. Which of the following 5 are advantages ( )";         System.out.println(str);         String str1 = str.replaceAll ("[\\pP\\p{Punct}]", "");         String str01 = str.replaceAll("^[1-9]d[.]", "");         System.out.println(" str1:" + str1);





        String str2 = str.replaceAll("[//pP]", "");
        System.out.println("str2:" + str2);


        String str3 = str.replaceAll("[//p{P}]", "");
        System.out.println("str3:" + str3);*/

        String path1 = "E:\\20230518\\Remove the serial number at the beginning of the test question\\tb.txt";//The read file path
        String path2

Guess you like

Origin blog.csdn.net/y15201653575/article/details/130764821