S
skelastic
Greetings,
I'm trying to parse the following line:
"00608 P 135 001 LEC Tu 2-5P 210 WHEELER Information Tech and Soceity 3
LAGUERRE"
i've constructed the following regexp:
/(\d{5}).(\D\s\w{2,4}).(\d{1,4}\s\D{3}).(\D{1,4}\s\d+).*(\d{1,4}\s\D{1,9}).(\w+).*(\d?).*(\w{1,14}).*/
with a input file i've successfully produced the following output:
control# 00608 ---- correct
course#: P 135 ---- correct
section#: 001 LEC ---- correct
day-hour#: Tu 2 ---- missing '-5P
room#: 3 LAGUERRE, ---- should be 210 WHEELER
course-name#: M --- IT and Soceity
credits#: --- should be 3
prof#: 5 --- should be LAGUERRE
i'm a novice to ruby and regexp. i would like to know if i'm taking the
right approach.
i'll eventually nail it but any hints or suggestions would be useful.
appreciate the help.
I'm trying to parse the following line:
"00608 P 135 001 LEC Tu 2-5P 210 WHEELER Information Tech and Soceity 3
LAGUERRE"
i've constructed the following regexp:
/(\d{5}).(\D\s\w{2,4}).(\d{1,4}\s\D{3}).(\D{1,4}\s\d+).*(\d{1,4}\s\D{1,9}).(\w+).*(\d?).*(\w{1,14}).*/
with a input file i've successfully produced the following output:
control# 00608 ---- correct
course#: P 135 ---- correct
section#: 001 LEC ---- correct
day-hour#: Tu 2 ---- missing '-5P
room#: 3 LAGUERRE, ---- should be 210 WHEELER
course-name#: M --- IT and Soceity
credits#: --- should be 3
prof#: 5 --- should be LAGUERRE
i'm a novice to ruby and regexp. i would like to know if i'm taking the
right approach.
i'll eventually nail it but any hints or suggestions would be useful.
appreciate the help.