Regexp::VerbalExpressions - Perl Regular expressions made easy
use Regexp::VerbalExpressions; # Create an example of how to test for correctly formed URLs my $re = verex ->start_of_line ->then('http') ->maybe('s') ->then('://') ->maybe('www.') ->anything_but(' ') ->end_of_line; if ('https://www.google.com/' =~ $re) { print 'We have a correct URL'; # This output will fire } else { print 'The URL is incorrect'; } print $re; # Outputs the actual expression used: ^(?:http)(?:s)?(?:\:\/\/)(?:www\.)?(?:[^\ ]*)$
Regexp::VerbalExpressions is a Perl module that helps to construct difficult regular expressions.
anything()
anything_but($value)
end_of_line()
find($value)
maybe($value)
start_of_line()
then($value)
any($value)
any_of($value)
br()
line_break()
range($from, $to)
tab()
word()
with_any_case()
stop_at_first()
search_one_line()
replace($source, $value)
add($expression)
multiple($value)
or()
https://github.com/VerbalExpressions/JSVerbalExpressions
Copyright (C) Takumi Akiyama.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Takumi Akiyama <t.akiym@gmail.com>
To install Regexp::VerbalExpressions, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Regexp::VerbalExpressions
CPAN shell
perl -MCPAN -e shell install Regexp::VerbalExpressions
For more information on module installation, please visit the detailed CPAN module installation guide.