10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi guys,
I need a help with a query. Basically i want to know the difference between (0+01)* and ((0+01)*)* . It seems whatever string can be generated by the first RE can also be generated by second and they should essentially be same. Am i missing something? (1 Reply)
Discussion started by: srkmish
1 Replies
2. UNIX for Dummies Questions & Answers
Hello,
I'm trying to rename a bunch of files that were named incorrectly. I know a little about regular expressions but I'm not very good at them.
Here is the image of the file names:
http://i47.tinypic.com/np2gxi.jpg
I'm trying to change the 20111116 at the beginning to 20101116 for all... (2 Replies)
Discussion started by: nastyn8
2 Replies
3. Programming
Hi all,
How am I read a file, find the match regular expression and overwrite to the same files.
open DESTINATION_FILE, "<tmptravl.dat" or die "tmptravl.dat";
open NEW_DESTINATION_FILE, ">new_tmptravl.dat" or die "new_tmptravl.dat";
while (<DESTINATION_FILE>)
{
# print... (1 Reply)
Discussion started by: jessy83
1 Replies
4. UNIX for Dummies Questions & Answers
I like to loop a list of files which named file1, file2, file3, file4, etc
if I like to loop them all over
for f in file1, file2, file3, file4
do
echo "processing" $f
done
how to use a regular expression to loop file$i instead?
Thank you. (4 Replies)
Discussion started by: ksgreen
4 Replies
5. Shell Programming and Scripting
Hey all! what matching expression might I use to match all characters included in \W, EXCEPT < and > ?
for example:
@tokens=split(/ ???? /,$string);
I've dubiously tried \W but this clips off the first letter of each "token", for some reason ... (2 Replies)
Discussion started by: applefat
2 Replies
6. UNIX for Dummies Questions & Answers
Folks;
Could some one tell me what these 2 regular expressions mean:
*/(*)/*
(\d\d\d\d/\d\d/\d\d/*?) (14 Replies)
Discussion started by: Katkota
14 Replies
7. UNIX for Dummies Questions & Answers
Folks;
I have 3 questions & any help with them would be really appreciated:
If i have a list of directories, for example:
/fs/pas/2007/4/6/2634210/admdat/examin
/fs/pas/2007/4/6/2634210/admdat2/stat
/fs/pas/2007/4/6/2634210/admdat3/data
/fs/pas/2007/4/6/2634210/im_2/0b.dcm
Now; my... (6 Replies)
Discussion started by: Katkota
6 Replies
8. UNIX for Dummies Questions & Answers
anyone knows what does this regular expression match for?
\(3,\).*\1.*\1 (1 Reply)
Discussion started by: metalwarrior
1 Replies
9. Shell Programming and Scripting
hi
i need to wipe out something from giving path i have some thing like that :
pwd | sed 's/.*foo//'
it is working fine when I have path like : /blah/balh1/foo/moo
so it erasing me all that comes before the foo including the foo
but I have problem when I have dir by the name of... (7 Replies)
Discussion started by: umen
7 Replies
10. UNIX for Dummies Questions & Answers
Hi - I am trying to ignore the following items from a list.
lp0
lp11
lp12
lp14
The following code works fine, but I was wondering if there was a tidier way to write the lp regular expression?
egrep -v "lp"
Thanks in advance. (3 Replies)
Discussion started by: Krispy
3 Replies
Syntax::Highlight::Engine::Simple(3pm) User Contributed Perl Documentation Syntax::Highlight::Engine::Simple(3pm)
NAME
Syntax::Highlight::Engine::Simple - Simple Syntax Highlight Engine
VERSION
This document describes Syntax::Highlight::Engine::Simple
SYNOPSIS
use Syntax::Highlight::Engine::Simple;
# Constractor
$highlight = Syntax::Highlight::Engine::Simple->new(%hash);
# Parameter configuration
$highlight->setParams(%hash);
# Syntax definision and addition
$highlight->setSyntax(%hash);
$highlight->appendSyntax(%hash);
# Perse
$highlight->doFile(%hash);
$highlight->doStr(%hash);
# Utilities
$highlight->array2regexp(%hash);
$highlight->getClassNames(%hash);
DESCRIPTION
This is a Syntax highlight Engine. This generates a part of HTML string by marking up the input string with span tags along the given rules
so that you can easily coloring with CSS.
Advantage is the simpleness. This provides a simple way to define the highlighting rules by packing the complicated part of it into regular
expression. Also, This works faster than similar highlight solutions on rough benchmarks.
Here is a working example of This module.
http://jamadam.com/dev/cpan/demo/Syntax/Highlight/Engine/Simple/
INTERFACE
new
new constractor calls for following arguments.
type
File type. This argument causes specific sub class to be loaded.
syntax
With this argument, you can assign rules in constractor.
setParams
This method calls for following arguments.
html_escape_code_ref
HTML escape code ref. Default subroutine escapes 3 characters '&', '<' and '>'.
setSyntax
Set the rules for highlight. It calls for a argument syntax in array.
$highlighter->setSyntax(
syntax => [
{
class => 'tag',
regexp => "<.+?>",
},
{
class => 'quote',
regexp => "'.*?'",
container => 'tag',
},
{
class => 'wquote',
regexp => '".*?"',
container => 'tag',
},
{
class => 'keyword',
regexp => 'somekeyword',
container => ['tag', 'quote', 'wquote'],
},
]
);
The array can contain rules in hash which is consists of 3 keys, class, regexp and container.
class
This appears to the output SPAN tag.
regexp
Regular expression to be highlighted.
container
Class names of allowed container. It can be given in String or Array. This restricts the regexp to stand only inside of the classes.
This parameter also works to ease the regulation some time. The highlighting rules doesn't stand in any container in default. This
parameter eliminates it.
appendSyntax
Append syntax by giving a hash.
$highlighter->setSyntax(
syntax => {
class => 'quote',
regexp => "'.*?'",
container => 'tag',
}
);
doStr
Highlighting input string and returns the marked up string. This method calls for following arguments.
str
String.
tab_width
Tab width for tab-space conversion. -1 for disable it. -1 is the default.
$highlighter->doStr(
str => $str,
tab_width => 4
);
doFile
Highlighting the file and returns the marked up string. This method calls for following arguments.
file
File name.
tab_width
Tab width for tab-space conversion. -1 for disable it. -1 is the default.
encode
Set the encode of file. utf8 is the default.
$highlighter->doStr(
str => $str,
tab_width => 4,
encode => 'utf8'
);
array2regexp
This is a utility method for converting string array to regular expression.
getClassNames
Returns the class names in array.
DIAGNOSTICS
"doStr method got undefined value"
"File open failed"
CONFIGURATION AND ENVIRONMENT
Syntax::Highlight::Engine::Simple requires no configuration files or environment variables. Specific language syntax can be defined with
sub classes and loaded in constructor if you give it the type argument.
DEPENDENCIES
UNIVERSAL::require
encoding
INCOMPATIBILITIES
None reported.
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to "bug-syntax-highlight-engine-Simple@rt.cpan.org", or through the web interface at
<http://rt.cpan.org>.
SEE ALSO
Syntax::Highlight::Engine::Simple::HTML
Syntax::Highlight::Engine::Simple::Perl
AUTHOR
Sugama Keita "<sugama@jamadam.com>"
LICENCE AND COPYRIGHT
Copyright (c) 2008, Sugama Keita "<sugama@jamadam.com>". All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
perl v5.12.4 2011-07-07 Syntax::Highlight::Engine::Simple(3pm)