Overview
| Artifact ID: | 31540dc69b2ce07b651511db0625da391a271c6ac62df44223713233e374a9b6 |
|---|---|
| Ticket: | 219219ffffffffffffffffffffffffffffffffff
greedy vs. non-greedy confusion |
| User & Date: | serhiy.storchaka on 2026-10-11 10:51:38 |
Changes
- icomment:
This is the documented rule: the first quantified atom, <code>.*?</code>, makes the whole match as short as possible, and <code><nowiki>[a-z]+</nowiki></code> is greedy only within it. PostgreSQL (same engine) gives the same result. Workarounds: <code><nowiki>(?:x.*?([a-z]+)){1,1}</nowiki></code> or <code><nowiki>x[^a-z]*([a-z]+)</nowiki></code>; both give <code>word</code>. The docs are clarified in branch [/timeline?r=doc-re-syntax-preference|doc-re-syntax-preference] (see [fe4fca32d9]). - login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"