[sc34wg3] CTM: IRI pattern contest
heuer at semagia.com
Fri Nov 7 08:12:33 EST 2008
> Anyway, we need a good pattern for it, so any suggestion would be
> helpful. Currently I use the following pattern (assuming that we
> restrict the IRIs further as I've proposed):
> schema-name ::= [a-zA-Z]+[a-zA-Z0-9\+\-\.]*
> autodetectable-iri ::= schema-name '://'
schema-name ::= [a-zA-Z]+[a-zA-Z0-9\+\-\.]*
autodetectable-iri ::= '://'([;\.\(\),:]*[^\s;\.\(\),:])+
pattern = re.compile(r'[a-zA-Z]+[a-zA-Z0-9\+\-\.]*://([;\.\(\),:]*[^\s;\.\(\),:])+')
The other solution would work as well, but it was unnecessary to
escape the "," and I converted the 'or' pattern into a character set.
Not sure which is more readable. I think, I'd prefer the character set
since I use a character set at the end of the pattern, too.
More information about the sc34wg3