Diez B. Roggisch
deets at nospam.web.de
Wed Jun 4 18:52:18 CEST 2008
David C. Ullrich schrieb:
> Actually using regular expressions for the first
> time. Is there something that allows you to take the
> union of two character sets, or append a character to
> a character set?
> Say I want to replace 'disc' with 'disk', but only
> when 'disc' is a complete word (don't want to change
> 'discuss' to 'diskuss'.) The following seems almost
> The problem is that that doesn't match if 'disc' is at
> the start or end of the string. Of course I could just
> combine a few re's with |, but it seems like there should
> (or might?) be a way to simply append a \A to the first
> [^a-zA-Z] and a \Z to the second.
I hope \w is really the literal for whitespace - might be something
different, see the docs.
More information about the Python-list