I am trying to develop a regular expression to read a pager message into categories. At the end are the responding brigades' codes (CBORT, CYAND)
These brigade codes represent each responding brigade. The issue is that there can either be one eg. (CBORT) or many eg. (CBAGR, CBORT, CYAND). I am unsure how to make the regex match each brigade as an individual match.
Each brigade code will have the letter C as a prefix.
Can this be done using a regular expression or will I require a PHP script to iterate through the last part of the message to match each of these brigade codes into an array?
Pager Message: @@ALERT BORT1 G&SC1 GRASS FIRE - SPREADING QUICKLY 79 BOORT-YANDO RD BOORT SVNW 214 J15 (475017) AFPR CBORT CYAND F190400036
Current Regex: (@@)(ALERT)\s(\w+)\s(\S+)(C1|C3)\s(.+)\s(\d+|\d+KM|\d+ M|CNR|NEAR|NEXT TO|ADJACENT|BEHIND|ACROSS FROM|ACROSS|REAR OF|REAR|OUTSIDE)\s(.+)\s(SVNW)\s(\d+)\s(\w\d+)\s((\d+))\s(F|AF|FP|AFP|AFPR|AFPRS)\s(C\w+)\s(F\d+)
The bold section is the section I wish to iterate 1 or many times.
Thank you