Previous: Capturing groups, Up: Functions [Contents][Index]
The functions in this section match the body of an email message against a regular expression. If the message is a multipart one (MIME), then its parts are descended recursively and each part that is recognized as a textual one is matched against the regexp.
The message is identified by its descriptor, a numeric value
returned from a previous call to mailbox_get_message
,
message_from_stream
, current_message
, or similar
function.
On success, these functions return a string identifying the part of the message that matched. For example, ‘1’ means the body of a plaintext email message. ‘1.2’ means second part (part numbers are 1-based) of a multipart message.
If the match isn’t found, empty string is returned.
Checks whether the body of the message msg (or any of its parts, if it is a MIME message) matches regular expression referred to by descriptor rx.
If optional charset is supplied, each message part is re-coded to that charset before matching.
Compiles rs and checks whether the body of the message msg (or any of its parts, if it is a MIME message) matches it.
If optional charset is supplied, each message part is re-coded to that charset before matching.
These functions use the Content-Type
header to decide whether
to apply the regular expression to the given message part, or just to
skip it. An internal structure called text mime type list
contains globbing patterns of the eligible content type values. The
actual value of the Content-Type
header is matched against each
list element in turn, until either a match is found (in which case the
part will be processed) or the end of list is reached (in which case
the part will be skipped).
By default, the text mime type list is initialized with a single value: ‘text/*’. To maintain the list, the following functions are provided:
Clears the list.
Arguments are strings in form ‘part/subpart’, where both part and subpart can be shell-style globbing patterns. The supplied strings are appended to the list.
Deletes from the list those patterns that match literally its arguments.
Previous: Capturing groups, Up: Functions [Contents][Index]