Bugzilla@Mozdev – Bug 26688
Multiple %matchTextFrom% in a line returns only 1 result
Last modified: 2019-08-11 13:04:20
You need to log in before you can comment on or make changes to this bug.
When using multiple %matchTextFromBody()% or %matchTextFromSubject()% functions within a line, the match seems to only work for the first function. Example: <p>Hallo %matchTextFromBody("Vorname: ([-'a-zA-Z\u00C0-\u024F]*)",1)% %matchTextFromBody("Nachname: ([-'a-zA-Z\u00C0-\u024F]*)",1)%, </p> This was used to extract first + last names from en Emil formatted as follows: Von: <email@adresse.de> Vorname: Willi Nachname: Waldmeister It only returned: <p>Hallo Willi,</p>
I modified the search patterns for matchTextFromBody and matchTextFromSubject as follows: /%matchTextFromBody\(.*?\)%/g /%matchTextFromSubject\(.*?\)%/g By adding a ? character after the * the pattern will stop at the earliest place possible before hitting the enclosing )% pattern.
Resolved fixed in 2.2, released 12/Aug/2019