This is only about transliteration (tr///), not rules in general.
So you are only matching a fixing set of strings at a certain position.
If one string is the prefix of another, the longer is preferred.
If there are two identical match strings, the replacement corresponding
to the first is used.
Larry Wall:
> Ruud H.G. van Tol:
>> John Macdonald:
>>> [trans]
>>> If a shorter rule is allowed to match first, then the longer
>>> rule can be removed from the match set, at least for constant
>>> string matches.
>>
>> It is not about the length of the rules, but about the length of the
>> match
On Fri, Dec 16, 2005 at 09:14:52AM -0800, Larry Wall wrote:
: It would be a useful exercise to write tr/// in terms of s///.
: It occurs to me that it'd be awfully useful to have a kind of hash
: that returns any unmatched key unchanged.
Actually, in this case it's handled by the fact that the nul
On Fri, Dec 16, 2005 at 01:29:11PM +0100, Ruud H.G. van Tol wrote:
: John Macdonald:
:
: > [trans]
: > If a shorter rule is allowed to match first, then the longer
: > rule can be removed from the match set, at least for constant
: > string matches.
:
: It is not about the length of the rules, bu
On 15/12/05 23:35, Larry Wall wrote:
On Thu, Dec 15, 2005 at 06:50:19PM +0100, Brad Bowman wrote:
: The "first in order" rule is more flexible, the user can sort their
: arrays to produce the longest input rule, or use another order if that is
: preferred.
What possible use is a user-ordered rul
John Macdonald:
> [trans]
> If a shorter rule is allowed to match first, then the longer
> rule can be removed from the match set, at least for constant
> string matches.
It is not about the length of the rules, but about the length of the
matches.
If both \s+ and \h+ match the same length, shou
On Thu, Dec 15, 2005 at 09:56:09PM +, Luke Palmer wrote:
> On 12/15/05, Brad Bowman <[EMAIL PROTECTED]> wrote:
> > Why does the longest input sequence win?
> >Is it for some consistency that that I'm not seeing? Some exceedingly
> > common use case? The rule seems unnecessarily restrictive
On Thu, Dec 15, 2005 at 06:50:19PM +0100, Brad Bowman wrote:
:
: Hi,
:
: S05 describes an array version of trans for transliteration:
: ( http://dev.perl.org/perl6/doc/design/syn/S05.html#Transliteration )
:
: The array version can map one-or-more characters to one-or-more
: characters:
:
On 12/15/05, Brad Bowman <[EMAIL PROTECTED]> wrote:
> Why does the longest input sequence win?
>Is it for some consistency that that I'm not seeing? Some exceedingly
> common use case? The rule seems unnecessarily restrictive.
Hmm. Good point. You see, the longest token wins because that's