12 Mar
2001
12 Mar
'01
4:09 p.m.
At 3/12/01 04:39 PM, Tino Wildenhain wrote:
in pure python you can also write: # ------------------------------------------------- import re
if re.search(r"[^A-Za-z0-9\.\-_]",string_name): raise Exception("illegal character here.")
# -------------------------------------------------
However this is untested. But you get the idea ;) re is certainly faster then in-loops.
I didn't test it either, but note that "." is not a special character inside the [] pair and that a bare "-" as the first or last character stands for itself. So the string could be more clearly written (imho) as just: [^A-Za-z0-9._-] -- Dennis Nichols nichols@tradingconnections.com