Re: Test not working so well

[email protected] (ToddAndMargo via perl6-users)
Newsgroups perl.perl6.users
Message-ID <[email protected]>
On 12/10/23 12:25, ToddAndMargo via perl6-users wrote:
> On 12/9/23 22:49, William Michels via perl6-users wrote:
>> f $x.match( / ^ <+[0..9] + [a..z]> ** 7 $ / ) { do something...};
> 
> 
> What is the difference between
> 
>      <+[0..9]
> and
>     <[0..9]
> 
> 
> And
>      / ^ <+[0..9] + [a..z]> ** 7 $ /
> 
> does this mean that both [0..9] AND [a..z] have to
> be present.  In other words is the an AND or an OR?

I am confused. What am I missing?

[0] > my Str $x="abc3defg"; if $x.match( / ^ <[0..9] + [h..z]> ** 8 $ / 
) { print "True\n"; } else { print "False\n" };
False

This would mean that both [0..9] and [h..z] would have to match.


[0] > my Str $x="abc3defg"; if $x.match( / ^ <[0..9] + [a..z]> ** 8 $ / 
) { print "True\n"; } else { print "False\n" };
True

This would mean that both [0..9] and [a..z] would have to match.



[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?


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?
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.