Re: Test not working so well

[email protected] (ToddAndMargo via perl6-users)
Newsgroups perl.perl6.users
Message-ID <[email protected]>
On 12/10/23 14:16, Kevin Pye wrote:
> 
> 
> On Mon, 11 Dec 2023, at 07:31, ToddAndMargo via perl6-users wrote:
> 
>> [0] > my Str $x="abc3defg"; if $x.match( / ^ <[0..9]> ** 8 $ / ) { print
>> "True\n"; } else { print "False\n" };
>> False
>>
>> "3" is in the string.  Why False?
> 
> Because you asked for a match with a string consisting entirely of exactly 8 digits.
> 
>> my Str $x="abc3defg"; if $x.match( / ^ <[a..h]> ** 8 $ / ) { print
>> "True\n"; } else { print "False\n" };
>> False
>>
>> a and b and c and d and e and f and g are also in the string.
>> Why the false?
> 
> Because the string doesn't exist of exactly eight letters in the range a..h. I.e. there's a 3 in there which isn't a letter in the range a..h.


I am not following.  :'(
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.