Overview
| Artifact ID: | a763584697281fa6a76a4cd7fa2464d90c051aee |
|---|---|
| Ticket: | 11250a236da29e6badf7755a1b67995defa5170f
unexpected non greedy matching behaviour |
| User & Date: | dkf 2015-05-18 08:24:54 |
Changes
- closedate changed to: "2457160.85062799"
- icomment:
Added text (post-render): <pre> <b>NOTE:</b> This means that you can usually make a RE be non‐greedy overall by putting <b>{1,1}?</b> after one of the first non‐constraint atoms or parenthesized sub‐expressions in it. <i>It pays to experi‐</i> <i>ment</i> with the placing of this non‐greediness override on a suit‐ able range of input texts when you are writing a RE if you are using this level of complexity. For example, this regular expression is non‐greedy, and will match the shortest substring possible given that “<b>abc</b>” will be matched as early as possible (the quantifier does not change that): ab{1,1}?c.*x.*cba The atom “<b>a</b>” has no greediness preference, we explicitly give one for “<b>b</b>”, and the remaining quantifiers are overridden to be non‐greedy by the preceding non‐greedy quantifier. </pre> - login: "dkf"
- mimetype: "text/html"