[Solved] how to split a string which contains of ( \n : , .)


You can use Pattern for regex split

String fields = "name[Employee Name], employeeno[Employee No], dob[Date of 
Birth], joindate[Date of Joining]";

Pattern pattern = Pattern.compile("\\[.+\\]+?,?\\s*" );

String[] split = pattern.split(fields);

References: How to split this string using Java Regular Expressions

0

solved how to split a string which contains of ( \n : , .)