nysus has asked for the wisdom of the Perl Monks concerning the following question:
Got a regex:
$input_text =~ s/^###*\s+[^\n]+\s+(?=^##)//gsm;
I want it to strip out markdown headers from a file that don't contain anything:
## This gets stripped ## This doesn't Because it contains this line ## More headers blah blah
But I also don't want it to strip this:
## This should not get stripped, but it does ### This should prevent it from getting stripped, but it doesn't stuff #### This should also not get stripped ##### But it does
Is there any way at all to pull this off with a regex?
$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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tricky regex problem
by Eily (Monsignor) on Jul 22, 2020 at 15:55 UTC | |
|
Re: Tricky regex problem
by tybalt89 (Monsignor) on Jul 22, 2020 at 16:00 UTC | |
|
Re: Tricky regex problem (updated)
by AnomalousMonk (Archbishop) on Jul 22, 2020 at 15:34 UTC | |
by nysus (Parson) on Jul 22, 2020 at 15:47 UTC | |
|
Re: Tricky regex problem
by LanX (Saint) on Jul 22, 2020 at 16:01 UTC | |
|
Re: Tricky regex problem
by nysus (Parson) on Jul 22, 2020 at 15:11 UTC |