Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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

by jettero (Monsignor)
on May 21, 2007 at 15:27 UTC ( #616590=note: print w/replies, xml ) Need Help??

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

It would work if you used $ instead. \z specifically asks for the end of the string and . won't match the \ns without a /s on the end. So .* and \z aren't adjacent in your first example — without the /s.

It probably would work with "\n" because .* could match 0 chars. But in your example, it already matched several chars before the \n which it refuses to slurp, so it (meaning the DFA) can't get to the \z at the end.

Of course, the more I think about it... you might argue that the .* should backtrack, skip over the \n and continue to match the 0 chars right before the \z. I believe \z has a special meaning though. It's not really matching characters. It's more of a border on things, like \b, so I suspect there really aren't 0 characters before it because it's not really there.

UPDATE: I'm completely convinced this is a bug based on "id-616551" below.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://616590]
[Cow1337killr]: <p>stevieb, you should leave an insightful comment at https://plugins. idea/plugin/7796- perl</p>
[Cow1337killr]: (Oops. HTML paragraph markup not needed.)
[stevieb]: Cow1337killr yeah, you're probably right. I have communicated to the author directly, and here on his threads. It's a tremenous setup. With Devel::Camelcadedb , you get full perl debug support too
[stevieb]: so now I can use CLion with the Perl plugin and have a single IDE for Perl/C/C++. It'll make writing C/XS dists much easier
[stevieb]: Python too, but I leave work at work

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2017-02-20 21:06 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (302 votes). Check out past polls.