Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Regex bug? matching multiple newline with /m

by NERDVANA (Deacon)
on Aug 09, 2021 at 08:15 UTC ( [id://11135722]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    # (not using 'say' because I wanted to try it on old perl versions)
    perl -e 'printf "%s\n", "ab\nab\n" =~ /^ab$ab$/m'
    ...
    perl -e 'printf "%s\n", "ab\nab\n" =~ /^(ab$ab)$/m'
    perl -e 'printf "%s\n", "ab\nab\n" =~ /^(ab)$ab$/m'
    perl -e 'printf "%s\n", "ab\nab\n" =~ /^(a)b$ab$/m'
    
  2. or download this
    perl -e 'printf "%s\n", "ab\nab\n" =~ /^(ab$a)b$/m'
    perl -e 'printf "%s\n", "ab\nab\n" =~ /^(ab$)ab$/m'
    ...
    perl -e 'printf "%s\n", "ab\nab\n" =~ /^(ab$){2}/m'
    perl -e 'printf "%s\n", "ab\nab\n" =~ /(ab$){2}/m'
    perl -e 'printf "%s\n", "ab\nab\n" =~ /(?^:^(?^m:(ab$){2}))/m'
    
  3. or download this
    perl -e 'printf "%s\n", "ab\nab\n" =~ /^((?:ab$)+)/m'
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-26 00:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found