Bugzilla@Mozdev – Bug 26214
Custom Templates: Regular expression to extract from subject
Last modified: 2017-03-24 07:21:21
You need to log in before you can comment on or make changes to this bug.
Expected result: 1. User move mail to folder triggering filter creation. 2. User selects custom template 3. Custom template run regex on subject to extract word/sentence which will be set in Match Rule field Possible solution: 1. User create custom template. 2. User select %regexpSubject("REGULAR_EXPRESION")% Example: Mail subject "Re: Case JR123123 [TOP][CRITCAL][INTERNAL] : Hardware failure during ...." Subject Match rule : JR123123
Accepted. It is somewhat esoteric but may come in handy. I might even be able to add it in my other addon SmartTemplate4 (which the header variables are actually copied from)
Created an attachment (id=8180) [details] quickFilters 3.2 Prerelease 9 Implemented the new custom header field: %subjectRegex()% It takes one variable, a regular expression which doesn't need to be wrapped in double quote characters. To test, open quickFilters settings and go to the Advanced tab. Click [New...] Custom Template, and give the new template a name. In the quickFilters Custom Template editor, on the top right select Custom Variables > Subject Regular Expression. This will add a condition: Subject contains %subjectRegex()% Insert a regular expression, e.g. %subjectRegex(\+[0-9]{4}\+)% in order to catch four digit numbers delimited by + (e.g. +1234+) Save the Custom Template. No create a new filter based on an email that has +1234+ in the subject. The filter assistant will call Regexp.exec() and pull out the _first_ match only and then add it to the conditions as Subject contains +1234+ (Note that the regular expression is only expanded / converted during _creation_ of the filter. When the Filter is applied the _value_ is used - so no regular expression matching occurs during filter executing the filter.
Created an attachment (id=8181) [details] quickFilters 3.2 Prerelease 9 Implemented the new custom header field: %subjectRegex()% It takes one variable, a regular expression which doesn't need to be wrapped in double quote characters. To test, open quickFilters settings and go to the Advanced tab. Click [New...] Custom Template, and give the new template a name. In the quickFilters Custom Template editor, on the top right select Custom Variables > Subject Regular Expression. This will add a condition: Subject contains %subjectRegex()% Insert a regular expression, e.g. %subjectRegex(\+[0-9]{4}\+)% in order to catch four digit numbers delimited by + (e.g. +1234+) Save the Custom Template. No create a new filter based on an email that has +1234+ in the subject. The filter assistant will call Regexp.exec() and pull out the _first_ match only and then add it to the conditions as: Subject contains +1234+ Notes: (1) the regular expression is only expanded / converted during _creation_ of the filter. When the Filter is applied the _value_ is used - so no regular expression matching occurs during filter executing the filter. (2) when the custom template is created the name follows the pattern "quickFilterCustomTemplate: XXX" do not delete the "quickFilterCustomTemplate" portion as it is needed for the filter assistant to display the new template in the filter assistant. It will be cut off automatically and only the "XXX" part displayed.
Renamed the feature for clarity.
Resolve FIXED: Released officially in 3.2