Captures all unescaped I<"any"> metacharacters, i.e. C<*> for wildcards or C<%> for SQL.

'a***b\\**' ==> 'a(.*)b\\*(.*)'

'a%%%b\\%%' ==> 'a(.*)b\\%(.*)'

=item *

C<'greedy'>

When used in conjunction with C<'any'>, it makes the C<'any'> captures greedy (by default they are not).

'a***b\\**' ==> 'a(.*?)b\\*(.*?)'

'a%%%b\\%%' ==> 'a(.*?)b\\%(.*?)'

=item *

C<'brackets'>

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.

The C<capture> method returns the L<Regexp::Wildcards> object.

=head2 C<convert>

my $rx = $rw->convert($wc);

my $rx = $rw->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'>, 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 = (defined $type) ? $self->_type($type) : $self;

return unless defined $wc;

my $e = $config->{escape};

# Escape :

# - an even number of \ that doesn't protect a regexp/wildcard metachar