[26508] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 8664 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 14 11:05:41 2005

Date: Mon, 14 Nov 2005 08:05:05 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 14 Nov 2005     Volume: 10 Number: 8664

Today's topics:
        How to handle nested regular expression in perl <raghavendra.ma@in.bosch.com>
    Re: How to handle nested regular expression in perl (Anno Siegel)
    Re: strange problem with system() and backtick operator <news@chaos-net.de>
    Re: strange problem with system() and backtick operator <tadmc@augustmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 14 Nov 2005 19:33:38 +0530
From: "Raghavendra Mahuli" <raghavendra.ma@in.bosch.com>
Subject: How to handle nested regular expression in perl
Message-Id: <dla5fv$jls$1@ns2.fe.internet.bosch.com>

Hi group,

I am using C regular expression functions regex and regcmp to validate some
record which are of the form-

REC1{ 'Bsgf' | 'Cjsdg' | 78 }

That is a fairly simple job.
But i have to extend it to handle nested records say like a record  REC2
which contains REC1

like :

REC2{'sjsd' | 2 | REC1{'Bsgf' | 'Cjsdg' | 78 }| REC2{ 'Bsgf' | 'Cjsdg' |
78 }}

Now the number preceding the nested record tells how many records will be
present. In this case, it is 2.

Can u pls suggest some way to handle nested regular expressions in perl.



Thanks in advance




------------------------------

Date: 14 Nov 2005 14:41:47 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How to handle nested regular expression in perl
Message-Id: <dla7nb$182$1@mamenchi.zrz.TU-Berlin.DE>

Raghavendra Mahuli <raghavendra.ma@in.bosch.com> wrote in comp.lang.perl.misc:
> Hi group,
> 
> I am using C regular expression functions regex and regcmp to validate some
> record which are of the form-
> 
> REC1{ 'Bsgf' | 'Cjsdg' | 78 }

A single example tells us nothing about the general form.  You must
specify which parts of the pattern can vary in which ways.

> That is a fairly simple job.
> But i have to extend it to handle nested records say like a record  REC2
> which contains REC1
> 
> like :
> 
> REC2{'sjsd' | 2 | REC1{'Bsgf' | 'Cjsdg' | 78 }| REC2{ 'Bsgf' | 'Cjsdg' |
> 78 }}

In the example REC2 contains a one REC1 and another REC2.  Is that an error?

> Now the number preceding the nested record tells how many records will be
> present. In this case, it is 2.
> 
> Can u pls suggest some way to handle nested regular expressions in perl.

You have a nested data structure.  I don't know what a nested regular
expression would be.

In general it is notoriously hard to deal with nested data structures
with regular expressions alone.  Perl offers some possibilities (see
perldoc -q nesting), but I doubt they carry over to a C/regcmp situation.

In Perl, I'd probably write a record parser (based on Parse::RecDescent)
and restrict regular expressions to the recognition of lexical elements.

Anno
-- 
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article.  Click on 
"show options" at the top of the article, then click on the 
"Reply" at the bottom of the article headers.


------------------------------

Date: Mon, 14 Nov 2005 15:13:06 +0100
From: Martin Kissner <news@chaos-net.de>
Subject: Re: strange problem with system() and backtick operator
Message-Id: <slrndnh6ri.35r.news@maki.homeunix.net>

John W. Krahn wrote :
>
> Have you tried the built-in chmod function?
>
> perldoc -f chmod

Thank you for that hint.
I did not knpw that there is a built-in chmod function.
I tried it quickly and it did not quite work as expected.
I will try it more thoroughly as soon as I have time to do so.

Anyway, I did not take into account that if I try to download a file
with permission less than 400 the file will not be downloaded but an
empty file will be created.

Nevertheless I'd be interessted, why my chmod command fails if the file
exists.

Thanks in advance
Martin

-- 
perl -e '$S=[[73,116,114,115,31,96],[108,109,114,102,99,112],
[29,77,98,111,105,29],[100,93,95,103,97,110]];
for(0..3){for$s(0..5){print(chr($S->[$_]->[$s]+$_+1))}}'


------------------------------

Date: Mon, 14 Nov 2005 08:37:07 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: strange problem with system() and backtick operator
Message-Id: <slrndnh88j.5cf.tadmc@magna.augustmail.com>

Martin Kissner <news@chaos-net.de> wrote:
> John W. Krahn wrote :

>> perldoc -f chmod
> 
> I tried it quickly and it did not quite work as expected.


Are you writing the permissions in octal (with a leading zero)?


> Nevertheless I'd be interessted, why my chmod command fails if the file
> exists.


It fails because you are doing something wrong.

We don't know what it is that you are doing, because you
have not shown us your code...


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 8664
***************************************


home help back first fref pref prev next nref lref last post