Javascript regex hangs (using v8)
Posted
by Engwan
on Stack Overflow
See other posts from Stack Overflow
or by Engwan
Published on 2010-03-09T09:25:46Z
Indexed on
2010/03/09
9:36 UTC
Read the original article
Hit count: 499
Im using this regex to get the contents of a tag in a file.
var regex = new RegExp("<tag:main>((?:.|\\s)*)</tag:main>");
This causes the v8 engine to hang indefinitely.
Now, if I use new RegExp("<tag:main>([\s\S]*)</tag:main>")
, all is good.
Anyone have an idea why the first one takes too long?
© Stack Overflow or respective owner