Hi!

I expected Tomahawk's t:validateRegExpr to always check the whole input. Today, 
I debugged through the tomahawk12-1.1.13 implementation of it (mainly 
AbstractRegExprValidator.validate()) and learned that this is not guaranteed. 
Please, correct me if I am wrong.

The implementation prefixes "^" and suffixes "$" obviously to force matching of 
the whole input. However, if the specified pattern contains alternatives like 
"a|b" then this makes it "^a|b$" which means: any input starting with a as well 
as any input ending with b.

I think either the documentation should state that the specified pattern is 
responsible for matching the whole pattern if this is intended. Or the 
implementation should be changed to something like prefixing with "^(?:" and 
suffixing with ")$" which would avoid the problem described above by enclosing 
the original pattern in a non-capturing group.

But there are different regular expression matching implementations around 
(like Apache ORO), probably with subtle differences; my Tomahawk implementation 
currently uses some Apache Commons Perl5Util (and not java.util.regex stuff, 
surprisingly). Therefore I am not really sure the prefix-suffix pair above 
works for every Tomahawk configuration. (It should work for Perl5 and 
java.util.regex at least, though.)

Martin


-- 
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                          
        
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a

Reply via email to