osTicket/osTicket-1.8 — pull request #1486 by greezybacon (2014-11-13 15:33:00+00:00)
Title: thread: Fix regex for ticket # in email subject

The ticket number regex was changed with the advent of custom ticket numbers, and it matches the closing punctuation in [#12345], that is, the closing bracket would be included in the ticket number sought in the database. Therefore, it would never match the ticket number properly.

The new regex attempts to match punctuation and non-punctuation groups so that punctuation in the middle of the ticket number is matched; however, punctuation at the end is not. So #12345+DEPT will match properly and will ignore any trailing whitespace and punctuation.