Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Can't figure out why capture group is not output by substitution regex

by Eily (Monsignor)
on Aug 24, 2020 at 15:57 UTC ( #11121037=note: print w/replies, xml ) Need Help??


in reply to Can't figure out why capture group is not output by substitution regex

I can fix this by assigning $2 go a new scalar variable first and then using the new variable.
Or simply $here =~ s/(^(#+)\s.*?\g2)/$1 =~ s|\n||rg/mse;

  • Comment on Re: Can't figure out why capture group is not output by substitution regex
  • Download Code

Replies are listed 'Best First'.
Re^2: Can't figure out why capture group is not output by substitution regex
by nysus (Parson) on Aug 24, 2020 at 16:15 UTC

    Yes, much simpler. Thanks.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
    $nysus = $PM . ' ' . $MCF;
    Click here if you love Perl Monks

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (1)
As of 2021-10-21 01:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (82 votes). Check out past polls.

    Notices?