I have a very large string that was a result of parsing and want to format it into csv format, that data is class information, currently is is just listed out as seen below, It has a pattern to it, but in a few cases is irregular. For example below I have the three cases , the first three lines is what the majority of the data looks like (class name, time, day), but is some cases the as seen by the middle case an extra time and day line are added(class name, time, day, time, day), and as seen by the last case, some classes dont have a time and day. (the actually data doesn't have a blank line in between it, I put it there to show the different cases)
CHM 110 - 10
9:30 am - 10:45 am
Thursday
CSC 150 - 04
10:30 am - 11:45 am
Monday
11:30 am - 12:45 am
Wednesday
BIO 132 - 01
How would I turn this data into a csv file, for example the above input would be format as such.
CHM 110 - 10, 9:30 am - 10:45 am, Thursday
CSC 150 - 04,10:30 am - 11:45 am, Monday, 11:30 am - 12:45 am, Wednesday
BIO 132 - 01
Not sure if im overthinking it, but i was thinking since every class has a name that is three capital letters followed by three numbers a dash and two numbers, could it be split from there somehow, put it into a single line and add commas to it.