Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^4: Strange regex to test for newlines: /.*\z/

by moritz (Cardinal)
on May 21, 2007 at 15:10 UTC ( [id://616586]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Strange regex to test for newlines: /.*\z/
in thread Strange regex to test for newlines: /.*\z/

Sorry, I still don't get it.

Obviously /\z/ matches the string "f\n", so why should it fail to match if I prepend it with something that matches the empty string? This should be independent of where the end of the string is considered to be.

And why does /.?\z/ match and /.*\z/ not?

If we expand that scheme, why does /.?.?\z/ match, and /.*.?\z/ not?

In all cases I'd expect .? and .* to be reduced to the empty string - why doesn't it happen?

  • Comment on Re^4: Strange regex to test for newlines: /.*\z/

Replies are listed 'Best First'.
Re^5: Strange regex to test for newlines: /.*\z/
by shmem (Chancellor) on May 21, 2007 at 15:47 UTC
    Now I'm confused as well, my mental model doesn't seem to fit (at least not everywhere :-)

    Maybe demerphq could tell?

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

      avar confirms this bug still exists in blead, so ill give it a look when i get a chance. right cant say more right now as i injured my arm today and hacking one handed is no fun. (yes im fine, or so the xrays said)

      ---
      $world=~s/war/peace/g

        as i injured my arm today and hacking one handed is no fun
        oh, then get well soon.
        i have a special keyboard for one-handed hackers that i could borrow you if you like ;-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-24 05:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found