-our @EXPORT = ();
-our @EXPORT_OK = ('wc2re', map { 'wc2re_' . $_ } keys %types);
-our @EXPORT_FAIL = qw/extract do_jokers do_commas do_brackets do_bracketed/;
-our %EXPORT_TAGS = ( all => [ @EXPORT_OK ] );
+=head2 C<$CaptureAny>
+
+By default this variable is false, and successions of unescaped I<"any"> wildcards (i.e. C<*> jokers or C<%> for SQL wildcards) are replaced by B<one> single C<.*>. When it evalutes to true, those sequences of I<"any"> wildcards are made into B<one> capture, which is greedy (C<(.*)>) for C<$CaptureAny E<gt> 0> and otherwise non-greedy (C<(.*?)>).
+
+ For jokers :
+ 'a***b\\**' is translated to 'a.*b\\*.*' if $CaptureAny is false (default)
+ 'a(.*)b\\*(.*)' if $CaptureAny > 0
+ 'a(.*?)b\\*(.*?)' otherwise
+
+ For SQL wildcards :
+ 'a%%%b\\%%' is translated to 'a.*b\\%.*' if $CaptureAny is false (default)
+ 'a(.*)b\\%(.*)' if $CaptureAny > 0
+ 'a(.*?)b\\%(.*?)' otherwise
+
+=cut
+
+our $CaptureAny = 0;
+
+sub capture_any {
+ return $CaptureAny ? (($CaptureAny > 0) ? '(.*)'
+ : '(.*?)')
+ : '.*';
+}
+
+=head2 C<$CaptureBrackets>
+
+If this variable is set to true, valid brackets constructs are made into C<( | )> captures, and otherwise they are replaced by non-capturing alternations (C<(?: | >)), which is the default.
+
+ 'a{b\\},\\{c}' is translated to 'a(b\\}|\\{c)' if $CaptureBrackets is true
+ 'a(?:b\\}|\\{c)' otherwise (default)
+
+=cut
+
+our $CaptureBrackets = 0;
+
+sub capture_brackets {
+ return $CaptureBrackets ? '('
+ : '(?:';
+}