[32646] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3922 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 12 18:09:22 2013

Date: Fri, 12 Apr 2013 15:09:02 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 12 Apr 2013     Volume: 11 Number: 3922

Today's topics:
    Re: newbie: Problem with $ and \ in strings <jwkrahn@example.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 12 Apr 2013 13:30:51 -0700
From: "John W. Krahn" <jwkrahn@example.com>
Subject: Re: newbie: Problem with $ and \ in strings
Message-Id: <0a_9t.423911$KR.33611@newsfe27.iad>

Ben Morrow wrote:
>
> Quoth vivek_12315<vivekchaurasiya@gmail.com>:
>> I m parsing a line like:
>>
>> line = [feature-tributary/access_db.wxs:35:<File
>> Name="EmptyDB.mdb" Source="$(env.ARCHIVE_DIRECTORY)\access_db\DS
>> Apps\Template\Database\FILE.mdb" KeyPath="yes" DiskId="2" Checksum="yes"
>> Id="a621e7596dfcc45ffaec5fe2bb    a84a6f1" />]
>>
>> Contents are in square brackets.
>
> Is this actually all on one line, or are there intervening newlines?
> This makes a difference to the /./ regex character: if you don't use /s,
> it won't match a newline. (My patterns below don't use /./, so are
> unaffected by this.)
>
>> I just want to extract the file name with is in the value of Source attribute.
>> i.e. FILE.mdb
>>
>> I tried doing
>>
>> 1.   if ($line =~ m/(.*)Source="(.*)"\sKeyPath(.*)/) {
>>
>> 2.   if ($line =~ m/(.*)Source="(.*)\.(.*)"(.*)/o) {
>
> You don't ever want to use /o. Since perl 5.6 (a very long time ago)
> perl precompiles all regexes, so /o will do no good and may do some
> harm.

The /o option only applies if variables are interpolated in the regular 
expression, but there are no variables in this case, so the /o option is 
superfluous.


John
-- 
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein


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

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:

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

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 V11 Issue 3922
***************************************


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