(BEG.*?KEYWORD.*?END)/g );
}
print $_ . "\n" foreach (@files);
Matt
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Vaughn, Terry
Sent: Tuesday, February 06, 2007 9:42 AM
To: perl-unix-users@listserv.activestate.com
Subject: [Perl-un
Can someone point out what I appear to be missing ? I am trying to extract
BEG ... KEYWORD .. END from the DATA string below:
I only want the BEG to END portion where KEYWORD is in between. As is. I
get the entire string.
Sorrynewline chars were removedMore readable form be
Can someone point out what I appear to be missing ? I am trying to
extract BEG ... KEYWORD .. END from the DATA string below:
I only want the BEG to END portion where KEYWORD is in between. As
is. I get the entire string.
#!/usr/bin/perl
while () {
push(@files, /(BE
MAIL PROTECTED] Behalf Of
[EMAIL PROTECTED]
Sent: Saturday, June 11, 2005 12:05 AM
To: perl-unix-users@listserv.activestate.com
Subject: [Perl-unix-users] regex numerical matching w/comma seperated
listsupport
#!/usr/bin/perl -w
use strict;
use warnings;
my @values = ('1','12','1
if ($value =~ /^[0-9]+(,[0-9]+)?$/)
{
HTH
George
BTW
use \d instead of [0-9].___
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Oops -- mistyped:
if ($value =~ /^[0-9]+(,[0-9]+)*$/)
{
should be correct i think.
Sorry :(
George___
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
@listserv.ActiveState.com
Subject: [Perl-unix-users] regex numerical matching w/comma seperated
listsupport
#!/usr/bin/perl -w
use strict;
use warnings;
my @values = ('1','12','123','1,2','12,34',',123','123,');
foreach my $valu
#!/usr/bin/perl -w
use strict;
use warnings;
my @values = ('1','12','123','1,2','12,34',',123','123,');
foreach my $value (@values) {
# check that value is number and it can be comma seperated list
of
# numbers but doesn't have to be. the last two values in
@values
#
praveen vejandla wrote:
> hi all,
>
> is it possible to replace all special characters in a string with their
> hex codes using regular expressions.?
Something like:
s/([^;\/?:@&=+\$,A-Za-z0-9\-_.!~*'() ])/sprintf("%02X",ord($1))/eg;
You can use groups of chars like \x00-\x1f and \x7f-\xff in
hi all,
is it possible to replace all special characters in a string with
their hex codes using regular expressions.?
pls reply,
regards,
praveen
_
There is always a better job for you at Monsterindia.com.
Go now http://monsterindia.com/re
I have a tool developed in perl that processes a file using regex and then
pumps the data into a Berkley DB file. the parts of the logic is as an
example as below
my @LMUData = ();
# Initiate the variables
# Main Logic
open (LMUFILE, $InputFile) or die "Could not ope
Well, I'm not sure what you mean by "anything upto a tilda", but you can
write 1 regex to do what you want:
$ more test.pl
#!/usr/bin/perl
$line = '(^FLJK asdf435jk~@!#$';
print "LINE (before): $line\n";
$line =~ s/[^\w\s~]//g;
print "LINE (after): $line\n";
$ perl test.pl
LINE (before): (^FL
Could someone let me know how I take out any non printable characters from a
string, i.e. anything except a-z, 0-9, space, and I think anything upto a
tilda , if it's possible in 1 regex it would be great..
thanks
Geoff
___
Perl-Unix-Users mailing li
Craig Sharp wrote:
> Hi all,
>
>
>
> I have a file with lines that are in the following format:
>
>
>
> 20011219 074645 b03 3524 switch 10.3.xxx.xxx 3
>
>
>
> I need to do a substitution so that the line appears as:
>
>
>
> 20011219 074645 b03-3524-switch 10.3.xxx.xxx 3
>
>
>
> Not
--- Craig Sharp <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a file with lines that are in the following
> format:
>
> 20011219 074645 b03 3524 switch 10.3.xxx.xxx 3
>
> I need to do a substitution so that the line appears
> as:
>
> 20011219 074645 b03-3524-switch 10.3.xxx.xxx 3
Another
Well, looking at the pattern, it looks like you need to start your
substitution when the pattern matches 'bNN' and ends when it hits an IP
address, matching 'NN\.' or 'NNN\.'.
So, here's some (baby-talk ;)) code:
#!/usr/bin/perl
$line = "20011219 074645 b03 3524 switch 10.3.xxx.xxx 3";
# brea
Hi all,
I have a file with lines that are in the following format:
20011219 074645 b03 3524 switch 10.3.xxx.xxx 3
I need to do a substitution so that the line appears as:
20011219 074645 b03-3524-switch 10.3.xxx.xxx 3
Note the inclusion of the dashes.
Here is another
Hi,
>
> ABc Sun May 20 19:45:30, 2001 XYZ
>
if you know the exact string your looking for, you can use
substr:
substr($string, "find_me", lenght_of_find_me) = "find_meD";
Regards,
Christian
--
Christian Schneider
[EMAIL PROTECTED]
Dan Jablonsky wrote:
>
> Hi all,
> I remember reading (probably in the Camel book) that
> the more $1, $2 and so on you have in a regex the
> slower the regex will be executed. It seems any
> backreference is taxing performance considerably.
>
> Is there an alternative? What I am trying to do is
-start-
> Grant Hopwood
>at06/13/2001 01:37 PM
>-start-
PS:
># Concatenation should generally always be faster than substitution which
kind of 'slices, dices, and stretches'
># a string.
That is, faster when replacing almost all of the string.
Grant Hopwood.
Valero Energy Corp.
(210)37
-start-
> Dan Jablonsky <[EMAIL PROTECTED]>
>at06/13/2001 12:22 PM
>Is there an alternative? What I am trying to do is
>isolate some patterns with each line of a text file
>and then make small changes to those pieces and/or
>switching the position of some of those pieces. Is it
>possible to
Hi all,
I remember reading (probably in the Camel book) that
the more $1, $2 and so on you have in a regex the
slower the regex will be executed. It seems any
backreference is taxing performance considerably.
Is there an alternative? What I am trying to do is
isolate some patterns with each line
22 matches
Mail list logo