+sub new {
+ my $class = shift;
+ $class = blessed($class) || $class || __PACKAGE__;
+
+ croak 'Optional arguments must be passed as key => value pairs' if @_ % 2;
+ my %args = @_;
+
+ my $self = bless { }, $class;
+
+ if (defined $args{do}) {
+ $self->do($args{do});
+ } else {
+ $self->type($args{type});
+ }
+
+ $self->capture($args{capture});
+}
+
+=head2 C<< new [ do => $what E<verbar> type => $type ], capture => $captures >>
+
+Constructs a new L<Regexp::Wildcard> object.
+
+C<do> lists all features that should be enabled when converting wildcards to regexps.
+Refer to L</do> for details on what can be passed in C<$what>.
+
+The C<type> specifies a predefined set of C<do> features to use.
+See L</type> for details on which types are valid.
+The C<do> option overrides C<type>.
+
+C<capture> lists which atoms should be capturing.
+Refer to L</capture> for more details.
+
+=head2 C<< do [ $what E<verbar> set => $c1, add => $c2, rem => $c3 ] >>
+
+Specifies the list of metacharacters to convert or to prevent for escaping.
+They fit into six classes :
+
+=over 4
+
+=item *
+
+C<'jokers'>
+
+Converts C<?> to C<.> and C<*> to C<.*>.
+
+ 'a**\\*b??\\?c' ==> 'a.*\\*b..\\?c'
+
+=item *
+
+C<'sql'>
+
+Converts C<_> to C<.> and C<%> to C<.*>.
+
+ 'a%%\\%b__\\_c' ==> 'a.*\\%b..\\_c'
+
+=item *
+
+C<'commas'>
+
+Converts all C<,> to C<|> and puts the complete resulting regular expression inside C<(?: ... )>.
+
+ 'a,b{c,d},e' ==> '(?:a|b\\{c|d\\}|e)'
+
+=item *
+
+C<'brackets'>
+
+Converts all matching C<{ ... , ... }> brackets to C<(?: ... | ... )> alternations.
+If some brackets are unbalanced, it tries to substitute as many of them as possible, and then escape the remaining unmatched C<{> and C<}>.
+Commas outside of any bracket-delimited block are also escaped.
+
+ 'a,b{c,d},e' ==> 'a\\,b(?:c|d)\\,e'
+ '{a\\{b,c}d,e}' ==> '(?:a\\{b|c)d\\,e\\}'
+ '{a{b,c\\}d,e}' ==> '\\{a\\{b\\,c\\}d\\,e\\}'
+
+=item *
+
+C<'groups'>
+
+Keeps the parenthesis C<( ... )> of the original string without escaping them.
+Currently, no check is done to ensure that the parenthesis are matching.
+
+ 'a(b(c))d\\(\\)' ==> (no change)
+
+=item *
+
+C<'anchors'>
+
+Prevents the I<beginning-of-line> C<^> and I<end-of-line> C<$> anchors to be escaped.
+Since C<[...]> character class are currently escaped, a C<^> will always be interpreted as I<beginning-of-line>.
+
+ 'a^b$c' ==> (no change)
+
+=back
+
+Each C<$c> can be any of :
+
+=over 4
+
+=item *
+
+A hash reference, with wanted metacharacter group names (described above) as keys and booleans as values ;
+
+=item *
+
+An array reference containing the list of wanted metacharacter classes ;
+
+=item *
+
+A plain scalar, when only one group is required.
+
+=back
+
+When C<set> is present, the classes given as its value replace the current object options.
+Then the C<add> classes are added, and the C<rem> classes removed.
+
+Passing a sole scalar C<$what> is equivalent as passing C<< set => $what >>.
+No argument means C<< set => [ ] >>.