[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: regexp question: match anything but not a group?
From: |
Thorsten Jolitz |
Subject: |
Re: regexp question: match anything but not a group? |
Date: |
Thu, 03 Apr 2014 21:36:01 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Andreas Röhler <andreas.roehler@easy-emacs.de> writes:
> Am 01.04.2014 23:30, schrieb Thorsten Jolitz:
>>
>> Hi List,
>>
>> how can I write a regexp that acts like e.g.
>>
>> ,------
>> | ".*?"
>> `------
>>
>
> BTW looks wrong. .* might much nothing, if non-greedy it remains
> nothing (?)
But it still seems valid to protect against greedyness?
,---------------------------------------------------------------------
| '*?', '+?', '??'
| These are "non-greedy" variants of the operators '*', '+' and '?
| '. Where those operators match the largest possible substring
| (consistent with matching the entire containing expression), the
| non-greedy variants match the smallest possible substring
| (consistent with matching the entire containing expression).
|
| For example, the regular expression 'c[ad]*a' when applied to
| the string 'cdaaada' matches the whole string; but the regular
| expression 'c[ad]*?a', applied to that same string, matches just
| 'cda'. (The smallest possible match here for '[ad]*?' that
| permits the whole expression to match is 'd'.)
`---------------------------------------------------------------------
--
cheers,
Thorsten
- regexp question: match anything but not a group?, Thorsten Jolitz, 2014/04/01
- Re: regexp question: match anything but not a group?, Andreas Röhler, 2014/04/02
- Re: regexp question: match anything but not a group?,
Thorsten Jolitz <=
- Re: regexp question: match anything but not a group?, Stefan Monnier, 2014/04/03
- Re: regexp question: match anything but not a group?, Thorsten Jolitz, 2014/04/04
- Message not available
- Re: regexp question: match anything but not a group?, Loris Bennett, 2014/04/04
- Re: regexp question: match anything but not a group?, Andreas Röhler, 2014/04/04
- Re: regexp question: match anything but not a group?, Thorsten Jolitz, 2014/04/04
- Re: regexp question: match anything but not a group?, Andreas Röhler, 2014/04/04
- Re: regexp question: match anything but not a group?, Andreas Röhler, 2014/04/04
- Re: regexp question: match anything but not a group?, Thorsten Jolitz, 2014/04/04
Re: regexp question: match anything but not a group?, Andreas Röhler, 2014/04/02