Re: How to put an AND in a regex?

2011-10-13 Thread C.DeRykus
On Oct 13, 3:33 am, ham...@nhn.leidenuniv.nl ("Hamann, T.D. (Thomas)") wrote: > > I am trying to write a regex that should only match when certain patterns are > not present, e.g. when a line does not start with either a digit or ALL-CAPS > text. I figured I could use negative look-aheads for th

Re: don't know where to start??? comparing files

2011-10-13 Thread Randal L. Schwartz
> "Dermot" == Dermot writes: Dermot> On 13 October 2011 03:07, Randal L. Schwartz wrote: >>> "Shawn" == Shawn H Corey writes: >> Shawn> #!/usr/bin/env perl >> >> Please.  Don't. Dermot> This is quite relevant for me at the moment. I have a couple of Dermot> projects where I will n

Re: How to put an AND in a regex?

2011-10-13 Thread Rob Dixon
On 13/10/2011 11:33, Hamann, T.D. (Thomas) wrote: Hi, I am trying to write a regex that should only match when certain patterns are not present, e.g. when a line does not start with either a digit or ALL-CAPS text. I figured I could use negative look-aheads forthis. I can write it as: if (/^(

Re: How to put an AND in a regex?

2011-10-13 Thread John Delacour
At 10:33 + 13/10/11, Hamann, T.D. (Thomas) wrote: ...So I need something that does the equivalent of "Don't match this AND don't match this". Is this possible in a if loop, or should I use something else? for (qw (bcd 1num ASDSF two)){ print "$_\n" if !/^[0-9]/ and !/^[A-Z]+/; } JD -

Re: Updating Perl without admin

2011-10-13 Thread Peter Scott
On Wed, 12 Oct 2011 20:18:20 -0500, Chris Stinemetz wrote: > To use perlbrew, it is required to install curl or wget first. perlbrew > depends on one of this two external commmands to be there in order to > fetch files from the internet. > > My unix OS doesn't have curl or wget. Is there a work ar

Re: How to put an AND in a regex?

2011-10-13 Thread Peter Scott
On Thu, 13 Oct 2011 10:33:17 +, Hamann, T.D. (Thomas) wrote: > I am trying to write a regex that should only match when certain > patterns are not present, e.g. when a line does not start with either a > digit or ALL-CAPS text. I figured I could use negative look-aheads for > this. > > I can w

Re: don't know where to start??? comparing files

2011-10-13 Thread Igor Dovgiy
May be this'll help? ) #!/usr/bin/perl use strict; use warnings; die 'Usage: ' . __FILE__ . " file1[ file2...]\n" unless @ARGV; my $ref_file = 'ref.txt'; my $new_file = 'new.txt'; open my $ref_fh, '<', $ref_file or die "Failed to open reference file - $!\n"; my %limits_for; while (<$ref_f

RE: How to put an AND in a regex?

2011-10-13 Thread Hamann, T.D. (Thomas)
Thanks! That was really simple (so simple I did not think about it ;) Thomas Van: Igor Dovgiy [ivd.pri...@gmail.com] Verzonden: donderdag 13 oktober 2011 14:10 Aan: beginners@perl.org Onderwerp: Re: How to put an AND in a regex? Hmm, probably you should.

Re: How to put an AND in a regex?

2011-10-13 Thread Igor Dovgiy
Hmm, probably you should. To use two of them in AND combination, just... use two of them. ) /^(?![[:upper:]][[:upper:]])(?!\d)/ And it gets even better: you may mix any number of look-aheads in a single regex this way. ) -- iD 2011/10/13 Hamann, T.D. (Thomas) > > Hi, > > I am trying to write

Re: don't know where to start??? comparing files

2011-10-13 Thread Dermot
On 13 October 2011 03:07, Randal L. Schwartz wrote: >> "Shawn" == Shawn H Corey writes: > > Shawn> #!/usr/bin/env perl > > Please.  Don't. This is quite relevant for me at the moment. I have a couple of projects where I will not be using the system perl and I was under the impression that u

How to put an AND in a regex?

2011-10-13 Thread Hamann, T.D. (Thomas)
Hi, I am trying to write a regex that should only match when certain patterns are not present, e.g. when a line does not start with either a digit or ALL-CAPS text. I figured I could use negative look-aheads for this. I can write it as: if (/^(?![[:upper:]][[:upper:]])/) { if (/^(?!\d)/)

Re: perl script help

2011-10-13 Thread james varghese
Thanks for the Suggestions Ken Slater and Jin Gibson. Sorry for the missing information's. Exactly what you people predicted is correct.($k is a file counter starting at zero, and $Line_Counter is a line counter starting at one) Script is modified according to the suggestions given by you and no