Comment #21 on issue 430 by erik.corry: Regex hardlock
http://code.google.com/p/v8/issues/detail?id=430

You don't need [\w], this is the same as just \w

I guess this:

(\.(\w+-?)*\w+)*

is supposed to indicate that dashes are allowed, but never two dashes together (why? URLs allow two together) and never at the start or the end (again, is that a rule?)

The problem is that it can match in lots of different ways and the regexp engine wants to try them all. Can I suggest instead:

(\.(?!-)(?:(?!--)[\w-])*\w)*

I haven't tested this, but I think this can only match in one way because none of the character classes include . and the inner braces have to start with a period. The negative lookahead assertions will prevent double dashes and starting with a dash and the final \w prevents it from ending with a dash.

In general the ([bar]*)* pattern will cause trouble if the input has a lot of b's a's and r's in a row. On the other hand (x[bar]*)* is OK (note that x is not inside the character class).

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to