spam at nospam.org
Wed Oct 27 23:59:34 CEST 2004
"Peter Otten" wrote in message news:clp4pj$2n2$01$1 at news.t-online.com...
> >>> re.findall(r"[.\n]", "\nx\n")
> ['\n', '\n']
> >>> re.findall(r"[.\n]", "\n.\n")
> ['\n', '.', '\n']
> It seems a dot inside  means a dot rather than "any character".
DOH! That's right in the docs too. <blush>
Used to indicate a set of characters. Characters can be listed individually,
or a range of characters can be indicated by giving two characters and
separating them by a "-". Special characters are not active inside sets. For
example, [akm$] will match any of the characters "a", "k", "m", or "$";
[a-z] will match any lowercase letter, and [a-zA-Z0-9] matches any letter or
digit. Character classes such as \w or \S (defined below) are also
acceptable inside a range. If you want to include a "]" or a "-" inside a
set, precede it with a backslash, or place it as the first character. The
pattern ] will match ']', for example.
Like I said, I'm learning. Nothing like experience! :)
Thanks for your help!
More information about the Python-list