X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FRegexp-Wildcards.git;a=blobdiff_plain;f=README;h=207bc2397baa8cba2ec269852214b0388da834e8;hp=4e5e7aa602a4e78e20e58ecf06e22fe782520fe9;hb=4ce36c10bb682fb575addd550bd8efe104061e00;hpb=144ef10ec993ec83d9a42af3fb6d1577e44d4bb7 diff --git a/README b/README index 4e5e7aa..207bc23 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ NAME expressions. VERSION - Version 1.04 + Version 1.05 SYNOPSIS use Regexp::Wildcards; @@ -13,8 +13,10 @@ SYNOPSIS my $re; $re = $rw->convert('a{b?,c}*'); # Do it Unix shell style. $re = $rw->convert('a?,b*', 'win32'); # Do it Windows shell style. - $re = $rw->convert('*{x,y}?', 'jokers'); # Process the jokers and escape the rest. - $re = $rw->convert('%a_c%', 'sql'); # Turn SQL wildcards into regexps. + $re = $rw->convert('*{x,y}?', 'jokers'); # Process the jokers and + # escape the rest. + $re = $rw->convert('%a_c%', 'sql'); # Turn SQL wildcards into + # regexps. $rw = Regexp::Wildcards->new( do => [ qw ], # Do jokers and brackets. @@ -22,7 +24,8 @@ SYNOPSIS ); $rw->do(add => 'groups'); # Don't escape groups. - $rw->capture(rem => [ qw ]); # Actually we want non-greedy matches. + $rw->capture(rem => [ qw ]); # Actually we want non-greedy + # matches. $re = $rw->convert('*a{,(b)?}?c*'); # '(.*?)a(?:|(b).).c(.*?)' $rw->capture(); # No more captures. @@ -41,7 +44,10 @@ DESCRIPTION provided. METHODS - "new [ do => $what | type => $type ], capture => $captures" + "new" + my $rw = Regexp::Wildcards->new(do => $what, capture => $capture); + my $rw = Regexp::Wildcards->new(type => $type, capture => $capture); + Constructs a new Regexp::Wildcard object. "do" lists all features that should be enabled when converting wildcards @@ -54,7 +60,12 @@ METHODS "capture" lists which atoms should be capturing. Refer to "capture" for more details. - "do [ $what | set => $c1, add => $c2, rem => $c3 ]" + "do" + $rw->do($what); + $rw->do(set => $c1); + $rw->do(add => $c2); + $rw->do(rem => $c3); + Specifies the list of metacharacters to convert or to prevent for escaping. They fit into six classes : @@ -125,12 +136,15 @@ METHODS $rw->do(set => 'jokers'); # Only translate jokers. $rw->do('jokers'); # Same. $rw->do(add => [ qw ]); # Translate also SQL and commas. - $rw->do(rem => 'jokers'); # Specifying both 'sql' and 'jokers' is useless. + $rw->do(rem => 'jokers'); # Specifying both 'sql' and + # 'jokers' is useless. $rw->do(); # Translate nothing. The "do" method returns the Regexp::Wildcards object. - "type $type" + "type" + $rw->type($type); + Notifies to convert the metacharacters that corresponds to the predefined type $type. $type can be any of : @@ -169,7 +183,12 @@ METHODS The "type" method returns the Regexp::Wildcards object. - "capture [ $captures | set => $c1, add => $c2, rem => $c3 ]" + "capture" + $rw->capture($captures); + $rw->capture(set => $c1); + $rw->capture(add => $c2); + $rw->capture(rem => $c3); + Specifies the list of atoms to capture. This method works like "do", except that the classes are different : @@ -203,15 +222,20 @@ METHODS 'a{b\\},\\{c}' ==> 'a(b\\}|\\{c)' - $rw->capture(set => 'single'); # Only capture "exactly one" metacharacters. + $rw->capture(set => 'single'); # Only capture "exactly one" + # metacharacters. $rw->capture('single'); # Same. - $rw->capture(add => [ qw ]); # Also greedily capture "any" metacharacters. + $rw->capture(add => [ qw ]); # Also greedily capture + # "any" metacharacters. $rw->capture(rem => 'greedy'); # No more greed please. $rw->capture(); # Capture nothing. The "capture" method returns the Regexp::Wildcards object. - "convert $wc [ , $type ]" + "convert" + my $rx = $rw->convert($wc); + my $rx = $rw->convert($wc, $type); + Converts the wildcard expression $wc into a regular expression according to the options stored into the Regexp::Wildcards object, or to $type if it's supplied. It successively escapes all unprotected regexp special @@ -257,7 +281,7 @@ SUPPORT . COPYRIGHT & LICENSE - Copyright 2007-2009 Vincent Pit, all rights reserved. + Copyright 2007,2008,2009,2013 Vincent Pit, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.