in reply to Re: Re: Re:{2} Getting impossible things right (behaviour of keys)
in thread Getting impossible things right (behaviour of keys)
It matches on the longest one, even though its at the end of the alternation.... thats because the regex engine works from left to right, and the first one that matches wins. That was the whole point of my post, sorry I wasn't more explicit.#!/usr/bin/perl -wT use strict; my $text = 'fedcba'; $text =~ (/(a|ba|cba|dcba)$/); print "Match: $1\n"; =OUTPUT Match: dcba
-Blake
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: Re: Re:{2} Getting impossible things right (behaviour of keys)
by demerphq (Chancellor) on Oct 25, 2001 at 00:11 UTC | |
by blakem (Monsignor) on Oct 25, 2001 at 01:49 UTC |