Test whether an SGML attribute value requires quoting
import re if re.compile('^[a-zA-Z0-9_\-\.:]+$').search(value): ...does not need quoting.. else: ...does need quoting...
TextSnippets > ubernostrum > regex
2798 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
James Bennett
import re if re.compile('^[a-zA-Z0-9_\-\.:]+$').search(value): ...does not need quoting.. else: ...does need quoting...