Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Help with a regular expression for file name parsing

by TJPride (Pilgrim)
on Dec 07, 2011 at 11:30 UTC ( #942222=note: print w/ replies, xml ) Need Help??


in reply to Re: Help with a regular expression for file name parsing
in thread Help with a regular expression for file name parsing

Your regular expression works, but the code is rather a muddle. Here's a version that he can use to test with:

$data = join '', <DATA>; print "$_\n" for $data =~ m[\@include\s('[^']+'|"[^"]+"|.+?(?<!\\))\s] +g; __DATA__ #some "random stuff" @include "some file" did you parse that? #more 'random' stuff @include 'another file' you sure? #and more random stuff @include yet\ another\ file positive?


Comment on Re^2: Help with a regular expression for file name parsing
Download Code
Re^3: Help with a regular expression for file name parsing
by bontchev (Sexton) on Dec 07, 2011 at 12:07 UTC
    When tested with this version, the output is just 1
      Are you sure you copied it correctly? I get this:
      "some file" 'another file' yet\ another\ file

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://942222]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (16)
As of 2014-11-25 21:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (158 votes), past polls