Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
-\n([^(]+)(\(\d\))[|]([^-]+)
/
gm

Description

-\n([^(]+)(\(\d\))[|]([^-]+)

<img width="677" alt="screen shot 2018-05-18 at 10 18 45 am" src="https://user-images.githubusercontent.com/19956136/40248458-d8f2695c-5a84-11e8-93b9-3234f2cf3d94.png">

Collect all match groups then write additional regex to key value them. The match groups that have OR must be processed further:

MATH 45    DIFFERNTL EQUATN SCI+ENGR  (3)|MATH 295    Differential Equations (3)
                                         |   OR 
                                         |MATH 287    Introduction to Linear (5)
                                         |            Algebra and 
                                         |            Differential Equations 
Submitted by anonymous - 6 years ago