Inline:

> On Dec 10, 2023, at 12:25, ToddAndMargo via perl6-users 
> <perl6-us...@perl.org> 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]
> 

Nothing, atm (although there may have been an issue with earlier iterations of 
Rakudo). Anyway, I find it better to be explicit.

See: 

https://docs.raku.org/language/regexes#Enumerated_character_classes_and_ranges

https://docs.raku.org/syntax/%3C%5B%20%5D%3E

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

See Kevin Pye's answer. Basically your regex is asking "Starting from the 
beginning of the string and ending at the end of the string, does the string 
consist of exactly 7 characters taken from the set of characters including the 
digits "0"-through-"9" and the lowercase letters "a"-through-"z"? If you 
satisfy those constraints you're okay (`True`). You could match a string where 
1) all 7 characters are digits, 2) all 7 characters are lowercase letters, or 
3) a mix of digits and lowercase letters adding up to 7 characters in length.

HTH, Bill.

Reply via email to