in reply to Printing out matches for two regular expressions
To find all the matches on one line, use while instead of if.
Finally, the second capture group populates $2, even after the vertical bar. Use a restart pattern to always start populating $1 in alternatives:
while (m/(?|(\d)+?|(?<=#)(.*?)(?= fin))/g) {
Which could be simplified to
while (m/(?|(\d)+?|#(.*?) fin)/g) {
Update: Are you sure about (\d)+? ? Have you tested it with numbers of more than one digit? You probably wanted just plain (\d+) .
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Printing out matches for two regular expressions
by Maire (Scribe) on Oct 22, 2017 at 10:07 UTC | |
by AnomalousMonk (Archbishop) on Oct 22, 2017 at 14:50 UTC | |
by Maire (Scribe) on Oct 23, 2017 at 06:40 UTC |