Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

regexp::shellish(3pm) [debian man page]

Shellish(3pm)						User Contributed Perl Documentation					     Shellish(3pm)

NAME
Regexp::Shellish - Shell-like regular expressions SYNOPSIS
use Regexp::Shellish qw( :all ) ; $re = compile_shellish( 'a/c*d' ) ; ## This next one's like 'a*d' except that it'll ## match 'a/d'. $re = compile_shellish( 'a**d' ) ; ## And here '**' won't match 'a/d', but behaves ## like 'a*d', except for the possibility of high ## cpu time consumption. $re = compile_shellish( 'a**d', { star_star => 0 } ) ; ## The next two result in identical $re1 and $re2. ## The second is a noop so that Regexp references can ## be easily accomodated. $re1 = compile_shellish( 'a{b,c}d' ) ; $re2 = compile_shellish( qr/A(?:a(?:b|c)d)/ ) ; @matches = shellish_glob( $re, @possibilities ) ; DESCRIPTION
Provides shell-like regular expressions. The wildcards provided are "?", "*" and "**", where "**" is like "*" but matches "/". See "com- pile_shellish" for details. Case sensitivity and constructs like <**>, "(a*b)", and "{a,b,c}" can be disabled. compile_shellish Compiles a string containing a 'shellish' regular expression, returning a Regexp reference. Regexp references passed in are passed through unmolested. Here are the transformation rules from shellish expression terms to perl regular expression terms: Shellish Perl RE ======== ======= * [^/]* ? . ** .* ## unless { star_star => 0 } ... .* ## unless { dot_dot_dot => 0 } ( ( ## unless { parens => 0 } ) ) ## unless { parens => 0 } {a,b,c} (?:a|b|c) ## unless { braces => 0 } a a ## These are de-escaped and * * ## passed to quotemeta() The wildcards treat newlines as normal characters. Parens group in to $1..$n, since they are passed through unmolested (unless option parens => 0 is passed). This is useless when using glob_shellish(), though. The final parameter can be a hash reference containing options: compile_shellish( '**', { anchors => 0, ## Doesn't put ^ and $ around the ## resulting regexp case_sensitive => 0, ## Make case insensitive dot_dot_dot => 0, ## '...' is now just three '.' chars star_star => 0, ## '**' is now two '*' wildcards parens => 0, ## '(', ')' are now regular chars braces => 0, ## '{', '}' are now regular chars } ) ; No option affects Regexps passed through. shellish_glob Pass a regular expression and a list of possible values, get back a list of matching values. my @matches = shellish_glob( '*/*', @possibilities ) ; my @matches = shellish_glob( '*/*', @possibilities, \%options ) ; AUTHOR
Barrie Slaymaker <barries@slaysys.com> perl v5.8.8 2002-01-24 Shellish(3pm)

Check Out this Related Man Page

PPI::Token::Regexp(3)					User Contributed Perl Documentation				     PPI::Token::Regexp(3)

NAME
PPI::Token::Regexp - Regular expression abstract base class INHERITANCE
PPI::Token::Regexp isa PPI::Token isa PPI::Element DESCRIPTION
The "PPI::Token::Regexp" class is never instantiated, and simply provides a common abstract base class for the three regular expression classes. These being: m// - PPI::Token::Regexp::Match s/// - PPI::Token::Regexp::Substitute tr/// - PPI::Token::Regexp::Transliterate The names are hopefully obvious enough not to have to explain what each class is. See their pages for more details. To save some confusion, it's worth pointing out here that "qr//" is not a regular expression (which PPI takes to mean something that will actually examine or modify a string), but rather a quote-like operator that acts as a constructor for compiled Regexp objects. METHODS
The following methods are inherited by this class' offspring: get_match_string The "get_match_string" method returns the portion of the regexp that performs the match. get_substitute_string The "get_substitute_string" method returns the portion of the regexp that is substituted for the match, if any. If the regexp does not substitute, "undef" is returned. get_modifiers The "get_modifiers" method returns the modifiers of the regexp. get_delimiters The "get_delimiters" method returns the delimiters of the regexp as an array. The first element is the delimiters of the match string, and the second element (if any) is the delimiters of the substitute string (if any). SUPPORT
See the support section in the main module. AUTHOR
Adam Kennedy <adamk@cpan.org> COPYRIGHT
Copyright 2001 - 2011 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.18.2 2011-02-25 PPI::Token::Regexp(3)
Man Page