On 2019-11-28 05:51, ToddAndMargo via perl6-users wrote:
Hi All,

I have a situation where I can see two different strings:

     "xxx      yyyy       zzz"
     "avcde    fg hi      jklmx"

"fg hi" only has one space in the middle.

All the words have multiple spaces between them.

Is there a way I can tell words that I want "fg hi" to
be considered one word?  A way to make the separator
two or more spaces?

Many thanks,
-T


Follow up:

Silly me.  Just use m/

    @RtnAry = qx ( wmic.exe volume get deviceid,label,name  ).lines;
    for @RtnAry.kv -> $I, $Line {
         if  $Line.chars == 0  { next; };
         # say $Line;

         $Line ~~ m/ (.*?) "  " (.*?) "  " (.*) /;
         # say "<" ~ "$0" ~ ">" ~ "\n";
         %LineHash<UUID>        = $0;
         %LineHash<Label>       = $1;
         %LineHash<DriveLetter> = $2;

         %LineHash<Label>       = %LineHash<Label>.trim;
         %LineHash<DriveLetter> = %LineHash<DriveLetter>.trim;

         %LineHash<UUID> ~~ s| .*? '\\' |\\|;  # dump the wierd 「 prefix
if not %LineHash<DriveLetter>.contains( ":" ) { %LineHash<DriveLetter> = "" }

         # say %LineHash ~ "\n";
         push( @Partitions, %LineHash );
# say %LineHash<UUID> ~ " " ~ %LineHash<Label> ~ " " ~ %LineHash<DriveLetter> ~ "\n";
         # say @Partitions[ $I ];
    }

Reply via email to