On Thu, Aug 21, 2008 at 1:40 PM, Bill Campbell <[EMAIL PROTECTED]> wrote:
> I've been beating my head against the wall try to figure out how
> to get regular expressions to match the font change sequences in
> *roff input (e.g. \fB for bold, \fP to revert to previous font).
> The re library maps r'\f' to the single form-feed character (as
> it does other common single-character sequences like
r'\n').


Does this example help?

###########################################
>>> sampleText = r"\This\ has \backslashes\."
>>> print sampleText
\This\ has \backslashes\.
>>> import re
>>> re.findall(r"\\\w+\\", sampleText)
['\\This\\', '\\backslashes\\']
###########################################
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to