-
-
06 Jul 2011 00:28:43 UTC
- Distribution: Regexp-SQL-LIKE
- Module version: 0.001
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (1)
- Testers (3556 / 4 / 73)
- Kwalitee
Bus factor: 1- 100.00% Coverage
- License: apache_2_0
- Perl: v5.10.0
- Activity
24 month- Tools
- Download (9.5KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
NAME
Regexp::SQL::LIKE - Translate SQL LIKE pattern to a regular expression
VERSION
version 0.001
SYNOPSIS
use Regexp::SQL::LIKE 'to_regexp'; my $re = to_regexp( "Hello %" ); # returns qr/^Hello .*/
DESCRIPTION
This module converts an SQL LIKE pattern to its Perl regular expression equivalent.
Currently, only
%
and.
wildcards are supported and only\
is supported as an escape character.No functions are exported by default. You may rename a function on import as follows:
use Regexp::SQL::Like to_regexp => { -as => 'regexp_from_like' };
See Sub::Exporter for more details on import customization.
FUNCTIONS
to_regexp
my $re = to_regexp( "Hello %" );
This function converts an SQL LIKE pattern into an equivalent regular expression. A
%
character matches any number of characters like.*
and a.
character matchs a single character. Backspaces may be used to escape%
,.
and\
itself:to_regexp( "Match literal \%" );
All other characters are run through
quotemeta()
to sanitize them.The function returns a compiled regular expression.
SUPPORT
Bugs / Feature Requests
Please report any bugs or feature requests by email to
bug-regexp-sql-like at rt.cpan.org
, or through the web interface at http://rt.cpan.org/Public/Dist/Display.html?Name=Regexp-SQL-LIKE. You will be automatically notified of any progress on the request by the system.Source Code
This is open source software. The code repository is available for public review and contribution under the terms of the license.
http://github.com/dagolden/regexp-sql-like
git clone http://github.com/dagolden/regexp-sql-like
AUTHOR
David Golden <dagolden@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2011 by David Golden.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
Module Install Instructions
To install Regexp::SQL::LIKE, copy and paste the appropriate command in to your terminal.
cpanm Regexp::SQL::LIKE
perl -MCPAN -e shell install Regexp::SQL::LIKE
For more information on module installation, please visit the detailed CPAN module installation guide.