-
-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add nested parens support, closes #23 #56
Conversation
@puzrin Hi, can you have a look at this PR please. |
Hi, this would be great to have fixed. |
It only supports 1 level of nesting? > require('../')().match('test http://example.com/(a(b(c(d)e)f)g) test')[0].text
'http://example.com/(a(b(c(d)e)f' Also, a word of caution - there could be a possibility of ReDoS here, but I was not able to come up with an exploit yet, so I could be wrong there (screenshot from debuggex.com). errata:
|
@torifat, at first glance, this looks incomplete and dangerous. I tend to reject. Objections? |
|
Sorry, I meant 2 levels. As soon as I found the example above - In any case, I think the right output is either About ReDoS: funnily enough, I think Regexp in this PR is a bit more complex. It may or may not be vulnerable (needs closer look which I don't have time for at the moment). But there is a regexp pattern that could cause it to be vulnerable after unrelated code changes (which isn't worth the hassle for a partial implementation imho). |
I will try to come up with something which addresses this issue. And, yes it's 2 levels 🤦♂️ I worked on this about a month ago. Sorry for causing the confusion. Thanks for taking your time to explain the problem. I'm closing this now will reopen with an updated PR. |
I need a bit different view:
In other words, if you improve very small % of missed cases and pay with significant maintenance difficulties - that's not good. Current parser is already in one step before falling into madness :). That's a price of "simple regexp use". |
Ah, ok. So, it's a very common use case for us. Jira creates links with parens when we apply
I agree with you. But, for us it's common that's why I was trying to fix it. |
Now understands. Use case "jira search results" looks reasonable. If you continue with PR please use such type of link in test/example. I see no problem to accept well-known narrow use-case when good universal implementation is not possible. |
No description provided.