Previous Next blank.gif blank.gif

Function markup_regex


SYNOPSIS

import HTMLgen
def markup_regex(text, rex=None, marker=None, collapse=0)

DESCRIPTION

Markup the contained text with a given regex with a given tag class instance. Uses regex module.

Arguments

text
string to act on
rex
a regular expression object or pattern which will be used to match all text patterns in the Paragraph body. Must have a single group defined. Group 1 is the matching text that will be marked. Default to all parenthetical text.
marker
an HTMLgen class instance (or any function) to which the found text will be sent for wrapping (using its __call__ method). Default is Emphasis. Can be your function as well.
collapse
Optional flag. When set to 1 removes the non- grouped matching text from the output. Default 0.

Returns the marked text and the number of matching text groups.

SEE ALSO

HTMLgen


Previous Next blank.gif blank.gif
Buzz.gif

Copyright © Robin Friedrich
All Rights Reserved
Comments to author: friedrich@pythonpros.com
Generated: Tue Mar 16 1999