Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: regex causing segmentation fault (core dump)

by hv (Prior)
on Mar 30, 2006 at 23:58 UTC ( [id://540327]=note: print w/replies, xml ) Need Help??


in reply to regex causing segmentation fault (core dump)

As Tanktalus says, this is almost certainly caused by recursion going past the end of the available stack space. I expect that it is caused specifically by the very first fragment of your regexp:

(?:.*\n)*?
.. the first time you try to use it on a file that has a few thousand lines not matching the next part of the pattern.

Since that fragment has no effect other than to ensure the rest of the pattern is anchored to the start of the line, I would suggest replacing:

m/(?:.*\n)*?rest of pattern/
with:
m/^rest of pattern/m
which I believe will solve your problem.

Hugo

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2024-04-19 08:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found