CRM-21264 - Fix broken regular expression
authorSean Madsen <sean@seanmadsen.com>
Thu, 15 Mar 2018 14:58:33 +0000 (10:58 -0400)
committerSean Madsen <sean@seanmadsen.com>
Thu, 15 Mar 2018 14:58:33 +0000 (10:58 -0400)
commit5aece37dacdc232414e44a511bfe4bcf87e61139
tree0906609c55623a70217daf7c312d7a6cecd7dc15
parent8dfeb798590fc874e43d9c781324b2f4055136b6
CRM-21264 - Fix broken regular expression

* Escape dot in token since it will be used in a regex (for good
  measure)
* Add `(?![\w-])` to ensure that `td` is not followed by other
  characters that would make it a different element.
* Instead of the first `.+?`, use `((?!</td>).)*` which matches zero or
  more characters but refuses to consume if it encounters `</td>`
* Escape curly braces (for good measure)
* Instead of the second `.+?`, use `.*?` so that it will match if there
  are zero characters. (Note: this change is really the crux of the
  issue, as described in CRM-21264).
* Complete then closing `</td>` (for good measure)
CRM/Contribute/Form/Task/PDFLetterCommon.php