Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
rhizome
on July 20, 2016
|
parent
|
context
|
favorite
| on:
Stack Overflow Outage Postmortem
Is there a difference between greedy and non-greedy atoms?
ghusbands
on July 20, 2016
[–]
In the order of searching and hence the match you can get, yes. In performance in the case of a non-match, no.
cyphar
on July 21, 2016
|
parent
[–]
The regex a?a?a?a?a?aaaaa against the string aaaaa will complete in linear time if you use non-greedy ?s but with greedy matching it has exponential complexity. So, there is a difference.
Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: