Hi I am trying to validate a CSV sheet line by line . The csv file contains :-
9,EditTest,expectedResult=nooptionsacltrue
10,AddTest,features={w;f;r}
1,AddTest,projectType=new,vtName=28HPM,status=ACTIVE,canOrder=Yes,expectedResult=duplicate
2,AddTest,projectType=old,vtName=28nm,status=ACTIVE,canOrder=Yes,expectedResult=invalidfeatures
Here is my code :-
public class Example {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new FileReader("testdbcsv/ACL.csv"));
while((line=br.readLine())!=null){
String pattern = "^(\\d+),(\\w+),((\\w+)=(\\w+)),((\\w+)=(\\w+)+?";
if(line.matches(pattern)){
System.out.println("pattern matched");
}
//Code
}
But my regex seems incorrect . Can anyone please help me with the correct regex for the csv. Thanks . Or is there any other way where I can validate my CSV according to a schema other than using regular expressions?