Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

regex help!

by anek77713 (Acolyte)
on Jul 12, 2013 at 09:45 UTC ( [id://1043925]=perlquestion: print w/replies, xml ) Need Help??

anek77713 has asked for the wisdom of the Perl Monks concerning the following question:

sub process_chapter { my ($path, $sections_href) = @_; my $text = read_file( $path ); $text =~ s/^L<(\w+)>/insert_section( $sections_href, $1, $path )/e +mg; $text =~ s/(=head1 .*)\n\n=head2 \*{3}/$1/g; return $text; }
what exactly does this regex? $text =~ s/(=head1 .*)\n\n=head2 \*{3}/$1/g;

Replies are listed 'Best First'.
Re: regex help!
by rjt (Curate) on Jul 12, 2013 at 09:51 UTC
    what exactly does this regex?

    I don't know, what happened when you tried to run it? What input do you want to run it on? How do I post a question effectively? Without sample data, I could tell you what the punctuation means, but so can perlre.

    If I had to guess, though, I'd wager it's someone's attempt at reinventing Pod::Parser / Pod::Simple.

      this piece of code is from this repository: https://github.com/timurn/modern_perl_book/tree/master/build/tools in build_chapters.pl

        Well, then, -- for posting code licensed under a Creative Commons Attribution license without attribution, and apologies for a most unbeknownst-to-me implication that the author (whose work I know and respect) would float out poorly designed code. In the context of the original source file, it makes much more sense.

        http://creativecommons.org/licenses/by-nc-sa/3.0/us/

        Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
Re: regex help! (regexplain)
by Anonymous Monk on Jul 12, 2013 at 09:59 UTC
    Does this help any, or is it just too confusing?
      hah, xRe::Token::Interpolation inside xRe::Structure::Replacement is not used as a pattern, one more todo item
      WoW !! that is cool!! Thnx!! didn't know this hint!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1043925]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-03-28 14:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found