NAME

String::Wildcard::Bash - Bash wildcard string routines

VERSION

This document describes version 0.01 of String::Wildcard::Bash (from Perl distribution String-Wildcard-Bash), released on 2014-07-26.

SYNOPSIS

use String::Wildcard::Bash qw(contains_wildcard);

say 1 if contains_wildcard(""));      # -> 0
say 1 if contains_wildcard("ab*"));   # -> 1
say 1 if contains_wildcard("ab\\*")); # -> 0

DESCRIPTION

FUNCTIONS

contains_wildcard($str) => bool

Return true if $str contains wildcard pattern. Wildcard patterns include * (meaning zero or more characters), ? (exactly one character), [...] (character class), {...,} (brace expansion). Can handle escaped/backslash (e.g. foo\* does not contain wildcard, it's foo followed by a literal asterisk *).

Aside from wildcard, bash does other types of expansions/substitutions too, but these are not considered wildcard. These include tilde expansion (e.g. ~ becomes /home/alice), parameter and variable expansion (e.g. $0 and $HOME), arithmetic expression (e.g. $[1+2]), history (!), and so on.

Although this module has 'Bash' in its name, this set of wildcards should be applicable to other Unix shells. Haven't checked completely though.

TODO

Function to parse string and return all the wildcards (with their types, positions, ...)

Function to strip wildcards from string.

Function to convert to other types of wildcards (and/or to check whether it can be represented with other types of wildcards).

Function to convert a regex pattern to equivalent wildcard?

SEE ALSO

Regexp::Wildcards to convert a string with wildcard pattern to equivalent regexp pattern. Can handle Unix wildcards as well as SQL and DOS/Win32. As of this writing (v1.05), it does not handle character class ([...]) and interprets brace expansion differently than bash.

Other String::Wildcard::* modules.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/String-Wildcard-Bash.

SOURCE

Source repository is at https://github.com/sharyanto/perl-String-Wildcard-Bash.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=String-Wildcard-Bash

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Steven Haryanto.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.