Main > Free Download Search >

Free regexp software for linux

regexp

Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 95
Kiwi Log Viewer (Lin) 2.0

Kiwi Log Viewer (Lin) 2.0


Free log file viewer for Linux more>> Kiwi Log Viewer for Linux is a freeware application that displays text based log files in a tabular format. Only a small section of the file is read from disk at a time which saves memory and allows you to view a file that would be too big to fit in memory. The tail option monitors the specified log file for changes and displays any new data that is added in real time. Features colorization based on sub-string or RegExp matches<<less
Download (1.2MB)
Added: 2009-04-12 License: Freeware Price: $0.00
198 downloads
Gauche 0.8.11

Gauche 0.8.11


Gauche is a scheme implementation for system scripting. more>>
Gauche is an R5RS Scheme implementation developed to be a handy script interpreter, which allows programmers and system administrators to write small to large scripts for their daily chores. Quick startup, built-in system interface, native multilingual support are some of my goals.
Gauche application runs on several Unix-like platforms.
Main features:
- Covers R5RS, almost.
- R5RS macro is supported as all of define-syntax, let-syntax, letrec-syntax forms. I think the speed of macro expansion is important as a script interpreter, and wrote R5RS macro expander in C, integrated in the internal compiler engine.
- Numeric operations are supported on fixnum, bignum, flonum and complex.
- Supports the following SRFIs.
- Module system:a simple module system, API compatible to STklos
- Object system:CLOS-like object system with metaobject protocol. Almost API compatible to STklos . It is also similar to Guile s object system.
- Multibyte string support: Strings are represented by multibyte string internally. You can use UTF-8, EUC-JP, Shift-JIS or no multibyte encoding by configure-time choice. Conversion between native coding system and external coding system is supported by port objects.
- Multibyte regexp: Regular expression matcher is aware of multibyte string; you can use multibyte characters both in patterns and matched strings.
- Reader extension: literal regexp and char-set, string interpolation: Extended reader recognizes #/.../ as an regular expression, and #[...] as a character set. Handy to write one-liners. (e.g. (rxmatch-substring (rxmatch #/(d+)/ "abc123def")) ==> "123")
- Also "string interpolation" is supported (e.g. (display #`"1 + 2 = ,(+ 1 2)n")).
- System interface: Covers most of POSIX.1 and some other features common in Unices. See section 6.19 of the reference manual for details.
- Network interface: Has API for socket-based network interface, including IPv6 if the OS suppots it.
- Multithreading: On some platforms, multithreading is supported on top of pthreads. Scheme-level API conforms SRFI-18.
- DBM interface: Interface to DBM-like libraries (dbm, ndbm and/or gdbm) if the system provides them.
- XML parsing: Oleg Kiselyovs SXML tools are included.
- OpenGL binding: OpenGL binding is provided in a separate package.
- GTK binding: GTK2 binding is provided in a separate package
Instalation
% gzcat Gauche-0.8.3.tgz | tar xf -
% cd Gauche-0.8.3
% ./configure
% make
% make install
Enhancements:
- Bug fixes include numerous edge-case bugs that caused SEGV or numeric error were fixed.
- Now pthread support is automatically enabled on suitable platforms even if you dont give --enable-threads configure option.
<<less
Download (2.9MB)
Added: 2007-08-17 License: BSD License Price:
798 downloads
Regexp::Genex 0.07

Regexp::Genex 0.07


Regexp::Genex - get the strings a regex will match, with a regex. more>>
Regexp::Genex - get the strings a regex will match, with a regex.

SYNPOSIS

# first try:
$ perl -MRegexp::Genex=:all -le print for strings(qr/a(b|c)d{2,3}e*/)

$ perl -x `pmpath Regexp::Genex`
#!/usr/bin/perl -l

use Regexp::Genex qw(:all);

$regex = shift || "a(b|c)d{2,4}?";

print "Trying: $regex";
print for strings($regex);
# abdd
# abddd
# abdddd
# acdd
# acddd
# acdddd


print "nThe regex code for that was:nqr/";
print strings_rx($regex);
print "/xn";

my $generator = generator($regex);
print "Taking first two using generator";
print $generator->() for 1..2;

my $big_rx = b*?c*?d*?; # * becomes {0,20}

my $big = generator($big_rx, ($max_length = 100) );

print "Taking string 100 of $big_rx";
print $big->(100); # (caveats below)
# ccccdddddddddddddddd NOT dx100 as you may expect

<<less
Download (0.008MB)
Added: 2007-08-16 License: Perl Artistic License Price:
800 downloads
ShiftJIS::Regexp 1.00

ShiftJIS::Regexp 1.00


ShiftJIS::Regexp contains regular expressions in Shift-JIS. more>>
ShiftJIS::Regexp contains regular expressions in Shift-JIS.

SYNOPSIS

use ShiftJIS::Regexp qw(:all);

match($string, p{Hiragana}{2}p{Digit}{2});
match($string, pH{2}pD{2});
# these two are equivalent:

This module provides some functions to use regular expressions in Shift-JIS on the byte-oriented perl.

The legal Shift-JIS character in this module must match the following regular expression:

[x00-x7FxA1-xDF]|[x81-x9FxE0-xFC][x40-x7Ex80-xFC]

To avoid false matching in multibyte encoding, this module uses anchoring technique to ensure each matching position places at the character boundaries.

cf. perlfaq6, "How can I match strings with multibyte characters?"

Functions

re(PATTERN)

re(PATTERN, MODIFIER)

Returns a regular expression parsable by the byte-oriented perl.

PATTERN is specified as a string. MODIFIER is specified as a string. Modifiers in the following list are allowed.

i case-insensitive pattern (only for ascii alphabets)
I case-insensitive pattern (greek, cyrillic, fullwidth latin)
j hiragana-katakana-insensitive pattern (but halfwidth katakana
are not considered.)

s treat string as single line
m treat string as multiple lines
x ignore whitespace (i.e. [x20nrtf]) unless backslashed
or inside a character class; but comments are not recognized!

o once parsed (not compiled!) and the result is cached internally.
o modifier
while ( ) {
print replace($_, (perl), $1, igo);
}
is more efficient than

while ( ) {
print replace($_, (perl), $1, ig);
}

because in the latter case the pattern is parsed every time
whenever the function is called.

match(STRING, PATTERN)

match(STRING, PATTERN, MODIFIER)

An emulation of m// operator aware of Shift-JIS. But, to emulate @list = $string =~ m/PATTERN/g, the pattern should be parenthesized (capturing parentheses are not added automatically).

@list = match($string, pH, g); # wrong; returns garbage!
@list = match($string,(pH),g); # good
PATTERN is specified as a string. MODIFIER is specified as a string.
i,I,j,s,m,x,o please see re().

g match globally
z tell the function the pattern matches an empty string
(sorry, due to the poor auto-detection)

replace(STRING or SCALAR REF, PATTERN, REPLACEMENT)

replace(STRING or SCALAR REF, PATTERN, REPLACEMENT, MODIFIER)

An emulation of s/// operator but aware of Shift-JIS.
If a reference to a scalar is specified as the first argument, substitutes the referent scalar and returns the number of substitutions made. If a string (not a reference) is specified as the first argument, returns the substituted string and the specified string is unaffected.

MODIFIER is specified as a string.

i,I,j,s,m,x,o please see re().
g,z please see match().

jsplit(PATTERN or ARRAY REF of [PATTERN, MODIFIER], STRING)

jsplit(PATTERN or ARRAY REF of [PATTERN, MODIFIER], STRING, LIMIT)

An emulation of CORE::split but aware of Shift-JIS.
In scalar/void context, it does not split into the @_ array; in scalar context, only returns the number of fields found.
PATTERN is specified as a string. But as PATTERN has no special meaning; it splits the string on a single space similarly to CORE::split / /.

When you want to split the string on whitespace, pass an undefined value as PATTERN or use the splitspace() function.

jsplit(undef, " x81x40 This is x81x40 perl.");
splitspace(" x81x40 This is x81x40 perl.");
# (This, is, perl.)

If you want to pass pattern with modifiers, specify an arrayref of [PATTERN, MODIFIER] as the first argument. You can also use "Embedded Modifiers").

MODIFIER is specified as a string.

i,I,j,s,m,x,o please see re().

splitspace(STRING)

splitspace(STRING, LIMIT)

This function emulates CORE::split( , STRING, LIMIT). It returns a list given by split STRING on whitespace including "x81x40" (IDEOGRAPHIC SPACE). Leading whitespace characters do not produce any field.

Note: splitspace(STRING, LIMIT) is equivalent to jsplit(undef, STRING, LIMIT).

splitchar(STRING)

splitchar(STRING, LIMIT)

This function emulates CORE::split(//, STRING, LIMIT). It returns a list given by split of STRING into characters.
Note: splitchar(STRING, LIMIT) is equivalent to jsplit(, STRING, LIMIT).

<<less
Download (0.035MB)
Added: 2007-08-08 License: Perl Artistic License Price:
811 downloads
Regexp::Common::time 0.01

Regexp::Common::time 0.01


Regexp::Common::time Perl module contains date and time regexps. more>>
Regexp::Common::time Perl module contains date and time regexps.

SYNOPSIS

use Regexp::Common qw(time);

# Piecemeal, Time::Format-like patterns
$RE{time}{tf}{-pat => pattern}

# Piecemeal, strftime-like patterns
$RE{time}{strftime}{-pat => pattern}

# Match ISO8601-style date/time strings
$RE{time}{iso}

# Fuzzy date patterns
# YEAR/MONTH/DAY
$RE{time}{ymd} # Most flexible
$RE{time}{YMD} # Strictest (equivalent to y4m2d2)
# Other available patterns: y2md, y4md, y2m2d2, y4m2d2

# MONTH/DAY/YEAR (American style)
$RE{time}{mdy} # Most flexible
$RE{time}{MDY} # Strictest (equivalent to m2d2y4)
# Other available patterns: mdy2, mdy4, m2d2y2, m2d2y4

# DAY/MONTH/YEAR (European style)
$RE{time}{mdy} # Most flexible
$RE{time}{MDY} # Strictest (equivalent to d2m2y4)
# Other available patterns: dmy2, dmy4, d2m2y2, d2m2y4

# Fuzzy time pattern
# HOUR/MINUTE/SECOND
$RE{time}{hms} # H: matches 1 or 2 digits; 12 or 24 hours
# M: matches 2 digits.
# S: matches 2 digits; may be omitted
# May be followed by "a", "am", "p.m.", etc.

This module creates regular expressions that can be used for parsing dates and times. See Regexp::Common for a general description of how to use this interface.

Parsing dates is a dirty business. Dates are generally specified in one of three possible orders: year/month/day, month/day/year, and day/month/year. Years can be specified with four digits or with two digits (with assumptions made about the century). Months can be specified as one digit, two digits, as a spelled-out name, or as a three-letter abbreviation. Day numbers can be one digit or two digits, with limits depending on the month (and, in the case of February, even the year). Also, different people use different punctuation for separating the various elements.
A human can easily recognize that "October 21, 2005" and "21.10.05" refer to the same date, but its tricky to get a program to come to the same conclusion. This module attempts to make it possible to do so, with a minimum of difficulty.

If you know the exact format of the data to be matched, use one of the specific, piecemeal pattern builders: tf or strftime. If there is some variability, use one of the fuzzy-matching patterns in the dmy, mdy, or ymd families. If the data are wildly variable, such as raw user input, give up and use the Date::Manip or Date::Parse module.

Time values are generally much simpler to parse than date values. Only one fuzzy pattern is provided, and it should suffice for most needs.

<<less
Download (0.035MB)
Added: 2007-08-07 License: Perl Artistic License Price:
808 downloads
Regexp::Log 0.04

Regexp::Log 0.04


Regexp::Log is a Perl base class for log files regexp builders. more>>
Regexp::Log is a Perl base class for log files regexp builders.

SYNOPSIS

my $foo = Regexp::Log::Foo->new(
format => custom %a %b %c/%d,
capture => [qw( host code )],
);

# the format() and capture() methods can be used to set or get
$foo->format(custom %g %e %a %w/%s %c);
$foo->capture(qw( host code ));

# this is necessary to know in which order
# we will receive the captured fields from the regexp
my @fields = $foo->capture;

# the all-powerful capturing regexp :-)
my $re = $foo->regexp;

while () {
my %data;
@data{@fields} = /$re/; # no need for /o, its a compiled regexp

# now munge the fields
...
}

<<less
Download (0.008MB)
Added: 2007-08-02 License: Perl Artistic License Price:
813 downloads
Math::Expr 0.2

Math::Expr 0.2


Math::Expr is a Perl module that parses mathematical expressions. more>>
Math::Expr is a Perl module that parses mathematical expressions.

SYNOPSIS

require Math::Expr;

$p=new Math::Expr;
$e=$p->Parse("a+4*b-d/log(s)+f(d,e)");

Parses mathematical expressions into a tree structure. The expressions may contain integers, real numbers, alphanumeric variable names, alphanumeric function names and most other characters might be used as operators. The operators can even be longer than one character! The only limitation is that a variable or function name may not start on a digit, and not all chars are accepted as operations. To be exact, here is the grammatic (in perl regexp notation):

< Expr > = -?< Elem >(< OpChr >< Elem >)*
< Elem > = < Number >|< Var >|< Function >|(< Expr >)
< Number > = < Integer >|< Float >
< Integer > = d+
< Float > = d*.d+
< Var > = [a-zA-Z][a-zA-Z0-9]*(:[a-zA-Z][a-zA-Z0-9]*)?
< Function > = [a-zA-Z][a-zA-Z0-9]*(< Expr >(,< Expr >)*)
< OpChr > = [^a-zA-Z0-9(),.:]+

If the - sign is present at the beginning of an < Expr > it is parsed in the exact same structure as 0< Expr >. That is to allow constructions like "-a*b" or "b+3*(-7)".

A variable consists of two parts separated by a :-char. The first part is the variable name, and the second optional part is its type. Default type is Real.

METHODS

$p = new Math::Expr

This is the constructor, it creates an object which later can be used to parse the strings.

$e=$p->Parse($str)

This will parse the string $str and return an expression tree, in the form of a Math::Expr::Opp object (or in simple cases only a Math::Expr::Var or Math::Expr::Num object).

$p->Priority({^=>50, /=>40, *=>30, -=>20, +=>10})

This will set the priority of ALL the operands (there is currently no way to change only one of them). The priority decides what should be constructed if several operands is listed without delimiters. Eg if a+b*c should be treated as (a+b)*c or a+(b*c). (Default is listed in header).

$p->SetOppDB($db)

Sets the OpperationDB to be used to $db. See Math::Expr::OpperationDB for more info. This will be passed down to all objects returned by the parser aswell.

<<less
Download (0.013MB)
Added: 2007-07-25 License: Perl Artistic License Price:
821 downloads
CGI::Enurl 1.07

CGI::Enurl 1.07


CGI::Enurl.pm is a Perl module for URL-encoding strings and hashes. more>>
CGI::Enurl.pm is a Perl module for URL-encoding strings and hashes.

SYNOPSIS

use CGI::Enurl;
%hash = (name=>Jenda Krynicky,address=>Nerudova 1016);
print "Location: http://$ENV{SERVER_NAME}/cgi-bin/do.pl?",enurl %hash,"nn";

This is a little module made for CGI scripting. It encodes the parameters to be passed to a CGI. It does nothing more, so its much smaller and loads more quickly.

Functions

enurl STRING
enurl ARRAY
enurl HASH

Encodes the parameter. If the parameter is a single string it encodes it and returns the encoded form.

If it is an array or a reference to an array it encodes all items and returns them joined by &.

If it is a hash it encodes the values and return a querystring in form "key2=encoded_value1&key2=encoded_value2&...".

!!! Please note that a hash in a list context returns a list of all keys and values. This means that if you call enurl(%hash) you will NOT get what you may thing you should. You HAVE to use enurl(%hash) !!!

enURL STRING

Encodes the parameter, this version doesnt encode = and & characters, so you should make sure they are not present in the data.

Notice the difference :

enurl a&b=f o o => a%26b%3Df+o+o
enURL a&b=f o o => a&b=f+o+o

$CGI::Enurl::ParamSeparator

You may specify another character to be used as the parameter separator. Simply set this variable to the character (or string) you want to use.
The default value is &

$CGI::Enurl::KeepUnencoded

This variable contains the characters that should stay unencoded. Please keep in mind that the string will be interpolated into a regexp in a [^...] group!

Any change of this variable will be ignored after the first call to enurl or enURL. (Im using /o switch in the regexp.) So if you want to change the variable you should do it as soon as posible. You may do that even before you "use" the module!

The default value is a-zA-Z 0-9_-@.=

<<less
Download (0.004MB)
Added: 2007-07-19 License: Perl Artistic License Price:
828 downloads
dot-mode.el 1.11

dot-mode.el 1.11


dot-mode.el is a minor mode for GNU Emacs / XEmacs that emulates the . command in vi. more>>
dot-mode.el is a minor mode for GNU Emacs / XEmacs that emulates the . command in vi. The original version was written in 1995 by James Gillespie.
I took over maintenance in 2000 and did a much needed update to code portability and also added some nice features. Much of the code was re-written, but the original design was sound and remains intact. dot-mode.el project is distributed under the GNU General Public License.
Why was it written?
For those of you not in the know, the . command in vi simply repeats the last edit made. In my experience, this is/has been the biggest feature that vi users claim they just cant live without. After having developed this feature for emacs, Id have to say I agree with them.
dot-mode.el was written so that vi users no longer have an excuse for not switching to an emacs variant. Emacs is, of course, superior in every other way...
Main features:
- New keybinding C-. emulates . command in vi.
- Calls to extended commands (M-x some-command) are also captured.
- There is an "override" mode that allows you to record keystrokes that dont change the buffer.
- You can specify whether dot-mode remembers "undo" commands.
- dot-mode can either share a single command buffer between all windows with dot-mode on, or each window can have its own command buffer.
- You can copy the saved keystrokes into the keyboard macro.
- Works on GNU Emacs (including NT Emacs) and XEmacs.
Version restrictions:
- Certain interactive commands such as query-replace or query-replace-regexp are not recorded properly. There is no plan to fix this. You can still record a keyboard macro to capture these types of functions.
Enhancements:
- A bug where dot-mode would give an error if you used dot-mode-override to record a [right] and then tried to call dot-mode-execute was fixed.
<<less
Download (0.021MB)
Added: 2007-07-12 License: GPL (GNU General Public License) Price:
838 downloads
Class::Struct::FIELDS 1.1

Class::Struct::FIELDS 1.1


Class::Struct::FIELDS module combine Class::Struct, base and fields. more>>
Class::Struct::FIELDS module combine Class::Struct, base and fields.

SYNOPSIS

(This page documents Class::Struct::FIELDS v.1.1.)
use Class::Struct::FIELDS;
# declare struct, based on fields, explicit class name:
struct (CLASS_NAME => { ELEMENT_NAME => ELEMENT_TYPE, ... });

use Class::Struct::FIELDS;
# declare struct, based on fields, explicit class name
# with inheritance:
struct (CLASS_NAME => [qw(BASE_CLASSES ...)],
{ ELEMENT_NAME => ELEMENT_TYPE, ... });

package CLASS_NAME;
use Class::Struct::FIELDS;
# declare struct, based on fields, implicit class name:
struct (ELEMENT_NAME => ELEMENT_TYPE, ...);

package CLASS_NAME;
use Class::Struct::FIELDS;
# declare struct, based on fields, implicit class name
# with inheritance:
struct ([qw(BASE_CLASSES ...)], ELEMENT_NAME => ELEMENT_TYPE, ...);

package MyObj;
use Class::Struct::FIELDS;
# declare struct with four types of elements:
struct (s => $, a => @, h => %, x => &, c => My_Other_Class);

$obj = new MyObj; # constructor

# scalar type accessor:
$element_value = $obj->s; # element value
$obj->s (new value); # assign to element

# array type accessor:
$ary_ref = $obj->a; # reference to whole array
$ary_element_value = $obj->a->[2]; # array element value
$ary_element_value = $obj->a (2); # same thing
$obj->a->[2] = new value; # assign to array element
$obj->a (2, newer value); # same thing

# hash type accessor:
$hash_ref = $obj->h; # reference to whole hash
$hash_element_value = $obj->h->{x}; # hash element value
$hash_element_value = $obj->h (x); # same thing
$obj->h->{x} = new value; # assign to hash element
$obj->h (x, newer value); # same thing

# code type accessor:
$code_ref = $obj->x; # reference to code
$obj->x->(...); # call code
$obj->x (sub {...}); # assign to element

# regexp type accessor:
$regexp = $obj->r; # reference to code
$string =~ m/$obj->r/; # match regexp
$obj->r (qr/ ... /); # assign to element

# class type accessor:
$element_value = $obj->c; # object reference
$obj->c->method (...); # call method of object
$obj->c (My_Other_Class::->new); # assign a new object

Class::Struct::FIELDS exports a single function, struct. Given a list of element names and types, and optionally a class name and/or an array reference of base classes, struct creates a Perl 5 class that implements a "struct-like" data structure with inheritance.

The new class is given a constructor method, new, for creating struct objects.
Each element in the struct data has an accessor method, which is used to assign to the element and to fetch its value. The default accessor can be overridden by declaring a sub of the same name in the package. (See Example 2.)

Each elements type can be scalar, array, hash, code or class.

<<less
Download (0.018MB)
Added: 2007-07-11 License: Perl Artistic License Price:
835 downloads
Text::RewriteRules 0.10

Text::RewriteRules 0.10


Text::RewriteRules Perl module contains a system to rewrite text using regexp-based rules. more>>
Text::RewriteRules Perl module contains a system to rewrite text using regexp-based rules.

SYNOPSIS

use Text::RewriteRules;

RULES email
.==> DOT
@==> AT
ENDRULES

email("ambs@cpan.org") # returns ambs AT cpan DOT org

RULES/m inc
(d+)=e=> $1+1
ENDRULE

inc("I saw 11 cats and 23 docs") # returns I saw 12 cats and 24 docs

ABSTRACT

This module uses a simplified syntax for regexp-based rules for rewriting text. You define a set of rules, and the system applies them until no more rule can be applied.

Two variants are provided:

traditional rewrite (RULES function):

while it is possible do substitute
| apply first substitution rule

cursor based rewrite (RULES/m function):

add a cursor to the begining of the string
while not reach end of string
| apply substitute just after cursor and advance cursor
| or advance cursor if no rule can be applied

A lot of computer science problems can be solved using rewriting rules.
Rewriting rules consist of mainly two parts: a regexp (LHS: Left Hand Side) that is matched with the text, and the string to use to substitute the content matched with the regexp (RHS: Right Hand Side).

Now, why dont use a simple substitute? Because we want to define a set of rules and match them again and again, until no more regexp of the LHS matches.

A point of discussion is the syntax to define this system. A brief discussion shown that some users would prefer a function to receive an hash with the rules, some other, prefer some syntax sugar.

The approach used is the last: we use Filter::Simple such that we can add a specific non-perl syntax inside the Perl script. This improves legibility of big rewriting rules sytems.

This documentation is divided in two parts: first we will see the reference of the module. Kind of, what it does, with a brief explanation. Follows a tutorial which will be growing through time and releases.

<<less
Download (0.008MB)
Added: 2007-07-10 License: Perl Artistic License Price:
837 downloads
XML::Filter::Mode 0.02

XML::Filter::Mode 0.02


XML::Filter::Mode Perl module can filter out all chunks not in the current mode. more>>
XML::Filter::Mode Perl module can filter out all chunks not in the current mode.

SYNOPSIS

use XML::Filter::Mode;
use strict;

my $filter = XML::Filter::Mode->new( Modes => "a,b,c" );
my $filter = XML::Filter::Mode->new( Modes => [qw( a b c )] );

## To inspect the modes:
my @modes = $filter->modes;

## To change the modes:
$h->modes( qw( d e ) );

Filters portions of documents based on a mode= attribute.

I use this to have XML documents that can be read in several modes, for instance "test", "demo" and normal (ie not test or demo), or "C", "Bytecraft_C", "Perl".

Mode names must contain only alphanumerics and "_" (ie match Perls w regexp assertion).

The filter is given a comma separated list of modes. Each element in the XML document may have a mode="" attribute that gives a mode expression. If there is no mode attribute or it is empty or the mode expression matches the list of modes, then the element is accepted. Otherwise it and all of its children are cut from the document.

The mode expression is a boolean expression using the operators & (which unfortunately must be escaped as "&"), |, , to build mode matching expressions from a list Parentheses may be used to group operations. of words. , and are synonyms.
! may be used as a prefix negation operator, so !a means "unless mode a".

Examples:

Modes mode="..." Action
Enabled Value
===== ========== ======
(none) "" pass

a "" pass
a "a" pass
a "a" pass
a,b "a" pass
a "a,b" pass
b "a,b" pass
a,b "a,b" pass
b "!a,b" pass
a,b "a b" pass

(none) "b" cut
a "b" cut
a "a&b" cut
b "a&b" cut
a "!a,b" cut
a "!a" cut

<<less
Download (0.004MB)
Added: 2007-07-02 License: Perl Artistic License Price:
844 downloads
Regexp::Wildcards 0.06

Regexp::Wildcards 0.06


Regexp::Wildcards is a Perl module that converts wildcard expressions to Perl regular expressions. more>>
Regexp::Wildcards is a Perl module that converts wildcard expressions to Perl regular expressions.

SYNOPSIS

use Regexp::Wildcards qw/wc2re/;

my $re;
$re = wc2re a{b?,c}* => unix; # Do it Unix style.
$re = wc2re a?,b* => win32; # Do it Windows style.
$re = wc2re *{x,y}? => jokers; # Process the jokers & escape the rest.
$re = wc2re %a_c% => sql; # Turn SQL wildcards into regexps.

In many situations, users may want to specify patterns to match but dont need the full power of regexps. Wildcards make one of those sets of simplified rules. This module converts wildcard expressions to Perl regular expressions, so that you can use them for matching. It handles the * and ? shell jokers, as well as Unix bracketed alternatives {,}, but also % and _ SQL wildcards. Backspace () is used as an escape character. Wrappers are provided to mimic the behaviour of Windows and Unix shells.

VARIABLES

These variables control if the wildcards jokers and brackets must capture their match. They can be globally set by writing in your program

$Regexp::Wildcards::CaptureSingle = 1;
# From then, "exactly one" wildcards are capturing
or can be locally specified via local
{
local $Regexp::Wildcards::CaptureSingle = 1;
# In this block, "exactly one" wildcards are capturing.
...
}
# Back to the situation from before the block

This section describes also how those elements are translated by the functions.
$CaptureSingle

When this variable is true, each occurence of unescaped "exactly one" wildcards (i.e. ? jokers or _ for SQL wildcards) are made capturing in the resulting regexp (they are be replaced by (.)). Otherwise, they are just replaced by .. Default is the latter.

For jokers :
a???b?? is translated to a(.)(.)(.)b?(.) if $CaptureSingle is true
a...b?. otherwise (default)

For SQL wildcards :
a___b__ is translated to a(.)(.)(.)b_(.) if $CaptureSingle is true
a...b_. otherwise (default)
$CaptureAny

By default this variable is false, and successions of unescaped "any" wildcards (i.e. * jokers or % for SQL wildcards) are replaced by one single .*. When it evalutes to true, those sequences of "any" wildcards are made into one capture, which is greedy ((.*)) for $CaptureAny > 0 and otherwise non-greedy ((.*?)).

For jokers :
a***b** is translated to a.*b*.* if $CaptureAny is false (default)
a(.*)b*(.*) if $CaptureAny > 0
a(.*?)b*(.*?) otherwise

For SQL wildcards :
a%%%b%% is translated to a.*b%.* if $CaptureAny is false (default)
a(.*)b%(.*) if $CaptureAny > 0
a(.*?)b%(.*?) otherwise
$CaptureBrackets

If this variable is set to true, valid brackets constructs are made into ( | ) captures, and otherwise they are replaced by non-capturing alternations ((?: | )), which is the default.

a{b},{c} is translated to a(b}|{c) if $CaptureBrackets is true
a(?:b}|{c) otherwise (default)

<<less
Download (0.009MB)
Added: 2007-06-29 License: Perl Artistic License Price:
849 downloads
Regexp::Ignore 0.03

Regexp::Ignore 0.03


Regexp::Ignore is a Perl module that let us ignore unwanted parts, while parsing text. more>>
Regexp::Ignore is a Perl module that let us ignore unwanted parts, while parsing text.

WARNING

This is an alpha code. Really. It was written in the end of 2001. It is not yet checked much. The only reason I submit it to CPAN that early is to get feedback about the idea, and hopefully to get some help in finding the many bugs that must still be in it. In our company we use this code, though, and for our needs it runs well.

SYNOPSIS

use Regexp::IgnoreXXX;

my $rei = new Regexp::IgnoreXXX($text,
"");
# split the wanted text from the unwanted text
$rei->split();

# use substitution function
$rei->s((var)_(d+), $2$1, gi);
$rei->s((d+):(d+), $2:$1);

# merge back to get the resulted text
my $changed_text = $rei->merge();

Markup languages, like HTML, are difficult to parse. The reason is that you can have a line like:

< font size=+1 >H< /font >ello < font size=+1 >W< /font >orld

How can we find the string "Hello World", in the above line, and replace it by "Hello Universe" (which is a lot deeper)? Or how can we run a speller on the text and replace the mistakes with suggestions for the correct spelling?
This module come to help you doing exactly that.

Actually the module let you first split the text to the parts you are interested in and the unwanted parts. For example, all the HTML tags can be taken as unwanted parts.

Then it let you parse the part you are interested in (while totally ignoring the unwanted parts).

In the end it let you merge back the unwanted parts with the possibly changed parts you were interested in.

There is just one catch. It uses the assumption that when you replace the above "Hello World" to "Hello Universe", all the unwanted parts between the start of the match to the end of the match, will be pushed after the text that will replace the match. This is not really understood right? Look at the example:
The text:

< font size=+1 >H< /font >ello < font size=+1 >W< /font >orld

will be first split and we will get the "cleaned" text:

Hello World

Then we can parse it using something like:

s/Hello World/Hello Universe/;

This will give us the changed "cleaned" text:

Hello Universe

When we will merge with the unwanted parts we will get

< font size=+1 >Hello Universe< /font >< font size=+1 >< /font >

So, the unwanted parts in the match were pushed after the replacer.

<<less
Download (0.070MB)
Added: 2007-06-29 License: Perl Artistic License Price:
847 downloads
B::Lint 1.09

B::Lint 1.09


B::Lint module contains Perl lint. more>>
B::Lint module contains Perl lint.

SYNOPSIS

perl -MO=Lint[,OPTIONS] foo.pl

The B::Lint module is equivalent to an extended version of the -w option of perl. It is named after the program lint which carries out a similar process for C programs.

OPTIONS AND LINT CHECKS

Option words are separated by commas (not whitespace) and follow the usual conventions of compiler backend options. Following any options (indicated by a leading -) come lint check arguments. Each such argument (apart from the special all and none options) is a word representing one possible lint check (turning on that check) or is no-foo (turning off that check). Before processing the check arguments, a standard list of checks is turned on. Later options override earlier ones. Available options are:

magic-diamond

Produces a warning whenever the magic readline is used. Internally it uses perls two-argument open which itself treats filenames with special characters specially. This could allow interestingly named files to have unexpected effects when reading.

% touch rm *|
% perl -pe 1

The above creates a file named rm *|. When perl opens it with it actually executes the shell program rm *. This makes dangerous to use carelessly.

context

Produces a warning whenever an array is used in an implicit scalar context. For example, both of the lines

$foo = length(@bar);
$foo = @bar;

will elicit a warning. Using an explicit scalar() silences the warning. For example,

$foo = scalar(@bar);

implicit-read and implicit-write

These options produce a warning whenever an operation implicitly reads or (respectively) writes to one of Perls special variables. For example, implicit-read will warn about these:

/foo/;

and implicit-write will warn about these:

s/foo/bar/;

Both implicit-read and implicit-write warn about this:

for (@a) { ... }

bare-subs

This option warns whenever a bareword is implicitly quoted, but is also the name of a subroutine in the current package. Typical mistakes that it will trap are:

use constant foo => bar;
@a = ( foo => 1 );
$b{foo} = 2;

Neither of these will do what a naive user would expect.

dollar-underscore

This option warns whenever $_ is used either explicitly anywhere or as the implicit argument of a print statement.

private-names

This option warns on each use of any variable, subroutine or method name that lives in a non-current package but begins with an underscore ("_"). Warnings arent issued for the special case of the single character name "_" by itself (e.g. $_ and @_).

undefined-subs

This option warns whenever an undefined subroutine is invoked. This option will only catch explicitly invoked subroutines such as foo() and not indirect invocations such as &$subref() or $obj->meth(). Note that some programs or modules delay definition of subs until runtime by means of the AUTOLOAD mechanism.

regexp-variables

This option warns whenever one of the regexp variables $`, $& or $ is used. Any occurrence of any of these variables in your program can slow your whole program down. See perlre for details.

all

Turn all warnings on.

none

Turn all warnings off.

<<less
Download (0.017MB)
Added: 2007-06-25 License: Perl Artistic License Price:
852 downloads
Secleted [ 0 ] software to compare
  • Page: 1 of 5
  • 1
  • 2
  • 3
  • 4
  • 5