Need helb writing a regular expression

Tuesday, July 8, 2014

These are some samples of the data I am working with(I made some comments on the side):



TSG MUM \n\nBS06-312
RQWE. FKB \n\nBS06-204
NM. JAK \n\nBS06-E05
DB. FKB \n\nBS06-312
IGT. resetk \n\nWender. //--> special CASE
ENG I. \n\nWEHN BS06-E06 \n\nENG II \n\nFLEM BS06-203 //--> special CASE: 2 Subjects
ITSI. MUM \n\nBS06-E02
PQT. RIE \n\nBS11-QCR PQT \n\nMARK BS11-QCR \n\nPQT FIS \n\nBS11-QCR //--> special CASE: several Subjects
INC FEY \n\nBS06-309
FU MAT \n\nSKU BS06-309
ABS. DOE \n\nBS06 ABS \n\nVOG BS06 \n\nABS HEI \n\nBS06 ABS \n\nMOR BS06 \n\nABS REM \n\nBS06 ABS \n\nDEI BS06 \n\nABS THA \n\nBS06
ENG III. \n\nGLIT BS06-209 \n\nENG II \n\nWANN BS06-208


These are subjects in a class shedule. The first letters represent the taught subject. After that its the teachers initials seperated by a space. The last position is the building and room number.


Sometimes there are sevaral subjects being taught on a specific time.


The data comes from an ics calendar file and I simply copied it here. The new line characters also need to be considered.


I need to extract the subject name, teachers initials and the room number so i can work with it. Any ideas on how to proceed? A complete regex pattern would be ideal.


I am working with php.


Thank you for your help.







http://ift.tt/1xKP0GM