On Sat, May 10, 2008 at 4:23 PM, Stefano Bagnara <[EMAIL PROTECTED]> wrote:
> I investigated a bit on this issue.
> Sieve specification says:
> ----
> The ":matches" version specifies a wildcard match using the characters "*"
> and "?".  "*" matches zero or more characters, and "?" matches a single
> character.  "?" and "*" may be escaped as "\\?" and "\\*" in strings to
> match against themselves.
> ----
> This means only * and ? are special chars.
> Instead jSieve uses a Glob expression compiler for the matches operator:
> http://james.apache.org/jsieve/xref/org/apache/jsieve/comparators/ComparatorUtils.html#104
> http://jakarta.apache.org/oro/api/org/apache/oro/text/GlobCompiler.html
>
> The problem is that a Glob expression supports much more than * and ?. So
> what is the solution to this?
> One solution is to write a custom oro.text.regex.PatternCompiler and use it.
> Another solution is to escape some of the chars in order to make the
> GlobCompiler work with * and ? only.
> Otherwise we could rewrite the input string to a Perl5regexp or a java regex
> before compiling.
> IMHO it is interesting to note that jSieve depends on ORO just for this
> class, so maybe the best thing would be to write our own matcher or to use
> builtin java regex.
> WDYT?

that has been my approach in the past in similar cases

> As a side note: why the ComparatorUtils uses the weird
> get/getBasic/update/set/compute pattern for the GlobCompiler and for the
> Perl5Matcher given that they are private and used only by static methods (so
> I see not really a single advantage over a simple lazy instantiation,
> because it could not anyway be overridden) ???

i recommend just moving away from oro

- robert

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to