+=item *
+
+C<'brackets'> will capture matching C<{ ... , ... }> alternations.
+
+ 'a{b\\},\\{c}' ==> 'a(b\\}|\\{c)'
+
+=back
+
+ $rw->capture(set => 'single'); # Only capture "exactly one" metacharacters.
+ $rw->capture('single'); # Same.
+ $rw->capture(add => [ qw/any greedy/ ]); # Also greedily capture "any" metacharacters.
+ $rw->capture(rem => 'greedy'); # No more greed please.
+ $rw->capture(); # Capture nothing.
+
+=head2 C<convert $wc [ , $type ]>
+
+Converts the wildcard expression C<$wc> into a regular expression according to the options stored into the L<Regexp::Wildcards> object, or to C<$type> if it's supplied. It successively escapes all unprotected regexp special characters that doesn't hold any meaning for wildcards, then replace C<'jokers'> or C<'sql'> and C<'commas'> or C<'brackets'> (depending on the L</do> or L</type> options), all of this by applying the C<'capture'> rules specified in the constructor or by L</capture>.
+
+=cut
+
+sub convert {
+ my ($self, $wc, $type) = @_;
+ _check_self $self;
+ my $config;
+ if (defined $type) {
+ $config = $self->_type($type);
+ } else {
+ $config = $self;
+ }
+ return unless defined $wc;
+ my $do = $config->{do};
+ my $e = $config->{escape};
+ $wc =~ s/(?<!\\)((?:\\\\)*[^\w\s\\$e])/\\$1/g;
+ if ($do->{jokers}) {
+ $wc = $self->_jokers($wc);
+ } elsif ($do->{sql}) {
+ $wc = $self->_sql($wc);
+ }
+ if ($do->{brackets}) {
+ $wc = $self->_bracketed($wc);
+ } elsif ($do->{commas}) {
+ if ($wc =~ /(?<!\\)(?:\\\\)*,/) { # win32 allows comma-separated lists
+ $wc = $self->{'c_brackets'} . $self->_commas($wc) . ')';
+ }
+ }
+ return $wc;
+}
+
+=head1 EXPORT
+
+An object module shouldn't export any function, and so does this one.
+
+=head1 DEPENDENCIES
+
+L<Carp> (core module since perl 5), L<Text::Balanced> (since 5.7.3).
+
+=head1 CAVEATS
+
+This module does not implement the strange behaviours of Windows shell that result from the special handling of the three last characters (for the file extension). For example, Windows XP shell matches C<*a> like C<.*a>, C<*a?> like C<.*a.?>, C<*a??> like C<.*a.{0,2}> and so on.