Greetings
I am trying to automatically create hyperlinks for reports in an agenda. The reports always follow the same formatting, which is "xxx-yy-zz AAA", where xxx is any number from 1-999, yy is a month (1-12), zz is a two digit year, and AAA is a two or three number abbreviation for which committee the report came from. Example 110-5-08 LEJ or 14-11-07 A&O. I want to replace those strings with a hyperlink to the report it references. This is what I have so far:
$pattern = "(\d{1,3}-\d{1,2}-\d{2})";
$replacement = "<a href=\"reportviewer.php?id=$1$2\">$1 $2</a>";
$agenda = "110-5-08 LEJ 1. Law Enforcement & Judiciary....<br>105-12-08 A&O 2. Administrations and Operations Committee ..."
$agenda = preg_replace($pattern, $replacement, $agenda);
Obviously I need a second group for the space and two/three letter abbreviation, but I can't seem to search past the numbers. I can't figure out how to search for a space and those letters, since I need them for the hyperlink. In my example the link should say reportviewer.php?id=110-5-08LEJ and reportviewer.php?id=105-12-08AO respectively. Stripping out the &, if included, is required as well. Any direction would be greatly appreciated.