Re: [Perl-unix-users] Regex question

2007-02-06 Thread Matt Schneider
(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

[Perl-unix-users] Regex question

2007-02-06 Thread Vaughn, Terry
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

[Perl-unix-users] Regex question

2007-02-06 Thread Vaughn, Terry
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

RE: [Perl-unix-users] regex numerical matching w/comma seperated listsupport

2005-06-11 Thread Sandeep Deshpande
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

Antwort: [Perl-unix-users] regex numerical matching w/comma seperated list support

2005-06-10 Thread Georg . Mavridis
        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

Antwort: [Perl-unix-users] regex numerical matching w/comma seperated list support

2005-06-10 Thread Georg . Mavridis
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

RE: [Perl-unix-users] regex numerical matching w/comma seperated listsupport

2005-06-10 Thread Matt Schneider
@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

[Perl-unix-users] regex numerical matching w/comma seperated list support

2005-06-10 Thread listmail
#!/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 #

Re: [Perl-unix-users] regex

2002-06-21 Thread $Bill Luebkert
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

[Perl-unix-users] regex

2002-06-21 Thread praveen vejandla
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

[Perl-unix-users] regex and multibyte characters

2002-05-10 Thread Sundara Rajan
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

Re: [Perl-unix-users] Regex Problem

2002-03-06 Thread Jason Purdy
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

[Perl-unix-users] Regex Problem

2002-03-06 Thread Geoff Ellis
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

Re: [Perl-unix-users] Regex problem

2002-01-07 Thread $Bill Luebkert
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

Re: [Perl-unix-users] Regex problem

2002-01-07 Thread Jim Angstadt
--- 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

Re: [Perl-unix-users] Regex problem

2002-01-07 Thread Jason Purdy
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

[Perl-unix-users] Regex problem

2002-01-07 Thread Craig Sharp
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

Re: [Perl-unix-users] regex performance

2001-06-14 Thread Christian Schneider
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]

Re: [Perl-unix-users] regex performance

2001-06-13 Thread $Bill Luebkert
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

Re: [Perl-unix-users] regex performance

2001-06-13 Thread Grant Hopwood
-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

Re: [Perl-unix-users] regex performance

2001-06-13 Thread Grant Hopwood
-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

[Perl-unix-users] regex performance

2001-06-13 Thread Dan Jablonsky
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